@stigg/terminal 0.0.1-alpha → 0.1.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.
Files changed (148) hide show
  1. package/LICENSE +18 -12
  2. package/README.md +2 -2
  3. package/dist/api/graphql-client.js +1 -1
  4. package/dist/api/operations.js +1 -4
  5. package/dist/auth/callback-server.js +1 -2
  6. package/dist/bin.js +0 -0
  7. package/dist/cli.js +2 -7
  8. package/dist/headless/init-phase2.js +1 -1
  9. package/dist/headless/setup.js +2 -2
  10. package/dist/launch/agent.js +1 -3
  11. package/dist/mcp/clients/claude-code.js +1 -1
  12. package/dist/mcp/clients/codex.js +1 -1
  13. package/dist/mcp/writer.js +1 -3
  14. package/dist/ui/intro/LogoView.js +2 -7
  15. package/dist/ui/tui/App.js +1 -1
  16. package/dist/ui/tui/hooks/useKeyBindings.js +1 -1
  17. package/dist/ui/tui/hooks/useStdoutDimensions.js +1 -4
  18. package/dist/ui/tui/primitives/PickerMenu.js +3 -5
  19. package/dist/ui/tui/screens/EnvScreen.js +2 -2
  20. package/dist/ui/tui/steps/AccountStep.js +1 -4
  21. package/dist/ui/tui/steps/ApiKeyStep.js +1 -1
  22. package/dist/ui/tui/steps/ClientsStep.js +1 -3
  23. package/dist/ui/tui/steps/SummaryStep.js +1 -3
  24. package/package.json +9 -10
  25. package/dist/api/client.d.ts +0 -6
  26. package/dist/api/format-key.d.ts +0 -7
  27. package/dist/api/graphql-client.d.ts +0 -5
  28. package/dist/api/operations.d.ts +0 -65
  29. package/dist/api/types.d.ts +0 -18
  30. package/dist/auth/callback-server.d.ts +0 -14
  31. package/dist/auth/config.d.ts +0 -2
  32. package/dist/auth/oauth.d.ts +0 -17
  33. package/dist/auth/storage.d.ts +0 -6
  34. package/dist/bin.d.ts +0 -2
  35. package/dist/cli.d.ts +0 -1
  36. package/dist/commands/dash.d.ts +0 -1
  37. package/dist/commands/debug.d.ts +0 -1
  38. package/dist/commands/debug.js +0 -53
  39. package/dist/commands/env.d.ts +0 -1
  40. package/dist/commands/init.d.ts +0 -13
  41. package/dist/commands/mcp.d.ts +0 -7
  42. package/dist/commands/skills.d.ts +0 -6
  43. package/dist/headless/host-agent.d.ts +0 -19
  44. package/dist/headless/init-phase1.d.ts +0 -9
  45. package/dist/headless/init-phase2.d.ts +0 -36
  46. package/dist/headless/next-step-prompt.d.ts +0 -7
  47. package/dist/headless/options.d.ts +0 -30
  48. package/dist/headless/reporter.d.ts +0 -16
  49. package/dist/headless/setup.d.ts +0 -29
  50. package/dist/launch/agent.d.ts +0 -55
  51. package/dist/mcp/clients/base.d.ts +0 -49
  52. package/dist/mcp/clients/claude-code.d.ts +0 -22
  53. package/dist/mcp/clients/claude-desktop.d.ts +0 -9
  54. package/dist/mcp/clients/codex.d.ts +0 -13
  55. package/dist/mcp/clients/cursor.d.ts +0 -9
  56. package/dist/mcp/clients/index.d.ts +0 -7
  57. package/dist/mcp/clients/mcp-remote.d.ts +0 -11
  58. package/dist/mcp/clients/vscode.d.ts +0 -17
  59. package/dist/mcp/clients.d.ts +0 -4
  60. package/dist/mcp/clients.js +0 -50
  61. package/dist/mcp/config-merge.d.ts +0 -9
  62. package/dist/mcp/writer.d.ts +0 -6
  63. package/dist/setup/storage.d.ts +0 -21
  64. package/dist/skills/install.d.ts +0 -19
  65. package/dist/types.d.ts +0 -35
  66. package/dist/ui/components/Card.d.ts +0 -11
  67. package/dist/ui/components/Card.js +0 -19
  68. package/dist/ui/components/ContextRow.d.ts +0 -11
  69. package/dist/ui/components/ContextRow.js +0 -8
  70. package/dist/ui/components/Footer.d.ts +0 -10
  71. package/dist/ui/components/Footer.js +0 -9
  72. package/dist/ui/components/Header.d.ts +0 -11
  73. package/dist/ui/components/Header.js +0 -6
  74. package/dist/ui/components/JsonPreview.d.ts +0 -13
  75. package/dist/ui/components/JsonPreview.js +0 -25
  76. package/dist/ui/components/SectionTitle.d.ts +0 -6
  77. package/dist/ui/components/SectionTitle.js +0 -5
  78. package/dist/ui/hooks/useAsyncEffect.d.ts +0 -3
  79. package/dist/ui/hooks/useResize.d.ts +0 -4
  80. package/dist/ui/hooks/useResize.js +0 -20
  81. package/dist/ui/hud.d.ts +0 -15
  82. package/dist/ui/ink-theme.d.ts +0 -2
  83. package/dist/ui/ink-theme.js +0 -34
  84. package/dist/ui/intro/LogoView.d.ts +0 -12
  85. package/dist/ui/intro/MatrixIntro.d.ts +0 -6
  86. package/dist/ui/intro/MatrixIntro.js +0 -80
  87. package/dist/ui/intro/logo.d.ts +0 -6
  88. package/dist/ui/messages.d.ts +0 -5
  89. package/dist/ui/screens/DashScreen.d.ts +0 -6
  90. package/dist/ui/screens/DashScreen.js +0 -27
  91. package/dist/ui/screens/DebugScreen.d.ts +0 -6
  92. package/dist/ui/screens/DebugScreen.js +0 -39
  93. package/dist/ui/screens/InitScreen.d.ts +0 -6
  94. package/dist/ui/screens/InitScreen.js +0 -138
  95. package/dist/ui/screens/MenuScreen.d.ts +0 -7
  96. package/dist/ui/screens/MenuScreen.js +0 -38
  97. package/dist/ui/state.d.ts +0 -72
  98. package/dist/ui/steps/AccountStep.d.ts +0 -8
  99. package/dist/ui/steps/AccountStep.js +0 -42
  100. package/dist/ui/steps/ApiKeyStep.d.ts +0 -8
  101. package/dist/ui/steps/ApiKeyStep.js +0 -91
  102. package/dist/ui/steps/ClientsStep.d.ts +0 -10
  103. package/dist/ui/steps/ClientsStep.js +0 -69
  104. package/dist/ui/steps/CredentialKindStep.d.ts +0 -7
  105. package/dist/ui/steps/CredentialKindStep.js +0 -18
  106. package/dist/ui/steps/EnvironmentStep.d.ts +0 -8
  107. package/dist/ui/steps/EnvironmentStep.js +0 -37
  108. package/dist/ui/steps/LoginStep.d.ts +0 -7
  109. package/dist/ui/steps/LoginStep.js +0 -56
  110. package/dist/ui/steps/SkillsStep.d.ts +0 -7
  111. package/dist/ui/steps/SkillsStep.js +0 -7
  112. package/dist/ui/steps/SummaryStep.d.ts +0 -8
  113. package/dist/ui/steps/SummaryStep.js +0 -41
  114. package/dist/ui/steps/WritingStep.d.ts +0 -10
  115. package/dist/ui/steps/WritingStep.js +0 -96
  116. package/dist/ui/theme.d.ts +0 -53
  117. package/dist/ui/tui/App.d.ts +0 -10
  118. package/dist/ui/tui/components/ContextStrip.d.ts +0 -11
  119. package/dist/ui/tui/components/TitleBar.d.ts +0 -6
  120. package/dist/ui/tui/components/WizardChecklist.d.ts +0 -7
  121. package/dist/ui/tui/hooks/keyboard-hints-utils.d.ts +0 -26
  122. package/dist/ui/tui/hooks/useKeyBindings.d.ts +0 -14
  123. package/dist/ui/tui/hooks/useKeyboardHints.d.ts +0 -13
  124. package/dist/ui/tui/hooks/useStdoutDimensions.d.ts +0 -8
  125. package/dist/ui/tui/primitives/BlinkingLabel.d.ts +0 -19
  126. package/dist/ui/tui/primitives/ConfirmPrompt.d.ts +0 -16
  127. package/dist/ui/tui/primitives/KeyboardHintsBar.d.ts +0 -2
  128. package/dist/ui/tui/primitives/PickerMenu.d.ts +0 -38
  129. package/dist/ui/tui/primitives/PromptLabel.d.ts +0 -6
  130. package/dist/ui/tui/primitives/ScreenContainer.d.ts +0 -39
  131. package/dist/ui/tui/primitives/Spinner.d.ts +0 -7
  132. package/dist/ui/tui/screens/DashScreen.d.ts +0 -6
  133. package/dist/ui/tui/screens/DebugScreen.d.ts +0 -6
  134. package/dist/ui/tui/screens/DebugScreen.js +0 -48
  135. package/dist/ui/tui/screens/EnvScreen.d.ts +0 -6
  136. package/dist/ui/tui/screens/InitScreen.d.ts +0 -9
  137. package/dist/ui/tui/screens/MenuScreen.d.ts +0 -7
  138. package/dist/ui/tui/start-tui.d.ts +0 -11
  139. package/dist/ui/tui/steps/AccountStep.d.ts +0 -8
  140. package/dist/ui/tui/steps/ApiKeyStep.d.ts +0 -8
  141. package/dist/ui/tui/steps/ClientsStep.d.ts +0 -10
  142. package/dist/ui/tui/steps/CredentialKindStep.d.ts +0 -7
  143. package/dist/ui/tui/steps/CredentialKindStep.js +0 -18
  144. package/dist/ui/tui/steps/EnvironmentStep.d.ts +0 -8
  145. package/dist/ui/tui/steps/LoginStep.d.ts +0 -8
  146. package/dist/ui/tui/steps/SkillsStep.d.ts +0 -7
  147. package/dist/ui/tui/steps/SummaryStep.d.ts +0 -10
  148. package/dist/ui/tui/steps/WritingStep.d.ts +0 -10
@@ -1,25 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Box, Text } from "ink";
3
- const COLOR = {
4
- add: "green",
5
- remove: "red",
6
- context: undefined,
7
- header: "cyan",
8
- };
9
- const PREFIX = {
10
- add: "+ ",
11
- remove: "- ",
12
- context: " ",
13
- header: "",
14
- };
15
- export function JsonPreview({ lines, title, }) {
16
- return (_jsxs(Box, { flexDirection: "column", children: [title && _jsx(Text, { dimColor: true, children: title }), lines.map((line, i) => {
17
- const color = COLOR[line.kind];
18
- return (_jsxs(Text, { color: color, dimColor: line.kind === "context", children: [PREFIX[line.kind], line.text] }, i));
19
- })] }));
20
- }
21
- export function jsonToDiffLines(entry, serverName) {
22
- const text = JSON.stringify({ [serverName]: entry }, null, 2);
23
- const lines = text.split("\n").slice(1, -1);
24
- return lines.map((line) => ({ kind: "add", text: line.replace(/^ /, "") }));
25
- }
@@ -1,6 +0,0 @@
1
- import React from "react";
2
- interface SectionTitleProps {
3
- children: React.ReactNode;
4
- }
5
- export declare function SectionTitle({ children, }: SectionTitleProps): React.ReactElement;
6
- export {};
@@ -1,5 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Box, Text } from "ink";
3
- export function SectionTitle({ children, }) {
4
- return (_jsx(Box, { marginBottom: 1, children: _jsx(Text, { bold: true, children: children }) }));
5
- }
@@ -1,3 +0,0 @@
1
- export declare function useAsyncEffect(fn: (signal: {
2
- cancelled: boolean;
3
- }) => Promise<void>, deps: unknown[], onError?: (err: unknown) => void): void;
@@ -1,4 +0,0 @@
1
- export declare function useResize(): {
2
- cols: number;
3
- rows: number;
4
- };
@@ -1,20 +0,0 @@
1
- import { useEffect, useState } from "react";
2
- export function useResize() {
3
- const [size, setSize] = useState(() => ({
4
- cols: process.stdout.columns ?? 80,
5
- rows: process.stdout.rows ?? 24,
6
- }));
7
- useEffect(() => {
8
- const handler = () => {
9
- setSize({
10
- cols: process.stdout.columns ?? 80,
11
- rows: process.stdout.rows ?? 24,
12
- });
13
- };
14
- process.stdout.on("resize", handler);
15
- return () => {
16
- process.stdout.off("resize", handler);
17
- };
18
- }, []);
19
- return size;
20
- }
package/dist/ui/hud.d.ts DELETED
@@ -1,15 +0,0 @@
1
- import { type StartTuiResult } from './tui/start-tui.js';
2
- export type HudScreen = 'menu' | 'init' | 'dash' | 'env';
3
- export interface HudOptions {
4
- initialScreen?: HudScreen;
5
- /** Fixed loopback port for the OAuth callback in the `init` flow. */
6
- callbackPort?: number;
7
- }
8
- export declare function runHud(options?: HudOptions): Promise<StartTuiResult>;
9
- /**
10
- * Run the HUD and, if the user chose to hand off into an agent from the summary
11
- * screen, spawn it once the TUI has fully torn down. Exits the process with the
12
- * agent's exit code. On launch failure, prints the seed prompt so the user can
13
- * paste it manually, then exits non-zero.
14
- */
15
- export declare function runHudThenMaybeLaunch(options?: HudOptions): Promise<void>;
@@ -1,2 +0,0 @@
1
- import { type Theme } from "@inkjs/ui";
2
- export declare const cyberdeckTheme: Theme;
@@ -1,34 +0,0 @@
1
- import { defaultTheme, extendTheme } from "@inkjs/ui";
2
- import { BRAND_LIME } from "./theme.js";
3
- const FOCUS = BRAND_LIME.brightest;
4
- const SELECTED = BRAND_LIME.primary;
5
- function labelStyle(props) {
6
- if (props.isFocused)
7
- return { color: FOCUS };
8
- if (props.isSelected)
9
- return { color: SELECTED };
10
- return {};
11
- }
12
- export const cyberdeckTheme = extendTheme(defaultTheme, {
13
- components: {
14
- Select: {
15
- styles: {
16
- focusIndicator: () => ({ color: FOCUS }),
17
- selectedIndicator: () => ({ color: SELECTED }),
18
- label: labelStyle,
19
- },
20
- },
21
- MultiSelect: {
22
- styles: {
23
- focusIndicator: () => ({ color: FOCUS }),
24
- selectedIndicator: () => ({ color: SELECTED }),
25
- label: labelStyle,
26
- },
27
- },
28
- Spinner: {
29
- styles: {
30
- frame: () => ({ color: FOCUS }),
31
- },
32
- },
33
- },
34
- });
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- interface LogoProps {
3
- /**
4
- * Width in terminal cells available to the logo row. Use the shell's
5
- * clamped content width — NOT raw terminal columns — so the tail extends
6
- * to the shell's right edge instead of overflowing past it and pushing
7
- * the STIGG glyphs off the left when the parent centers the row.
8
- */
9
- containerWidth: number;
10
- }
11
- export declare function Logo({ containerWidth }: LogoProps): React.ReactElement;
12
- export {};
@@ -1,6 +0,0 @@
1
- import React from "react";
2
- interface Props {
3
- onComplete: () => void;
4
- }
5
- export declare function MatrixIntro({ onComplete }: Props): React.ReactElement;
6
- export {};
@@ -1,80 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Box, Text } from "ink";
3
- import pc from "picocolors";
4
- import { useEffect, useRef, useState } from "react";
5
- import { BRAND_LIME, shouldRenderAnimation } from "../theme.js";
6
- import { Logo, computeWaveTail, renderLeafLines } from "./LogoView.js";
7
- import { isLogoCellFilled, LOGO_COLS, LOGO_ROWS, SUBTITLE, logoCellAt, } from "./logo.js";
8
- const RAIN_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*<>?{}[]/=+-*";
9
- const FRAME_MS = 60;
10
- const TAIL_LEN = 4;
11
- const MAX_DURATION_MS = 1500;
12
- function randChar() {
13
- return RAIN_CHARS.charAt(Math.floor(Math.random() * RAIN_CHARS.length));
14
- }
15
- function brand(hex, ch) {
16
- const r = parseInt(hex.slice(1, 3), 16);
17
- const g = parseInt(hex.slice(3, 5), 16);
18
- const b = parseInt(hex.slice(5, 7), 16);
19
- return `\x1b[1;38;2;${r};${g};${b}m${ch}\x1b[0m`;
20
- }
21
- export function MatrixIntro({ onComplete }) {
22
- const animate = shouldRenderAnimation();
23
- const completedRef = useRef(false);
24
- const [, setTick] = useState(0);
25
- const headsRef = useRef(Array.from({ length: LOGO_COLS }, () => Math.floor(-Math.random() * LOGO_ROWS * 1.8)));
26
- const speedRef = useRef(Array.from({ length: LOGO_COLS }, () => 0.6 + Math.random() * 0.6));
27
- const complete = () => {
28
- if (completedRef.current)
29
- return;
30
- completedRef.current = true;
31
- onComplete();
32
- };
33
- useEffect(() => {
34
- if (!animate) {
35
- const id = setTimeout(complete, 250);
36
- return () => clearTimeout(id);
37
- }
38
- const start = Date.now();
39
- const id = setInterval(() => {
40
- for (let i = 0; i < LOGO_COLS; i++) {
41
- headsRef.current[i] += speedRef.current[i];
42
- }
43
- setTick((t) => t + 1);
44
- if (Date.now() - start >= MAX_DURATION_MS) {
45
- clearInterval(id);
46
- complete();
47
- }
48
- }, FRAME_MS);
49
- return () => clearInterval(id);
50
- }, [animate]);
51
- if (!animate) {
52
- return _jsx(Logo, {});
53
- }
54
- const lines = [];
55
- for (let row = 0; row < LOGO_ROWS; row++) {
56
- let line = "";
57
- for (let col = 0; col < LOGO_COLS; col++) {
58
- const head = headsRef.current[col];
59
- const headRow = Math.floor(head);
60
- const logoCh = logoCellAt(row, col);
61
- const isFilled = isLogoCellFilled(row, col);
62
- if (row < headRow - TAIL_LEN) {
63
- line += isFilled ? brand(BRAND_LIME.brightest, logoCh) : " ";
64
- }
65
- else if (row === headRow) {
66
- line += brand(BRAND_LIME.primary, randChar());
67
- }
68
- else if (row < headRow && row >= headRow - TAIL_LEN) {
69
- line += pc.green(randChar());
70
- }
71
- else {
72
- line += " ";
73
- }
74
- }
75
- lines.push(line);
76
- }
77
- const tailRows = computeWaveTail(Date.now());
78
- const leafLines = renderLeafLines();
79
- return (_jsxs(Box, { flexDirection: "column", children: [leafLines.map((line, i) => (_jsx(Text, { children: line }, `leaf-${i}`))), _jsx(Box, { marginLeft: 2, marginTop: 1, children: _jsx(Text, { dimColor: true, children: SUBTITLE }) }), lines.map((line, i) => (_jsx(Text, { children: line + (tailRows[i] ?? "") }, `cd-${i}`)))] }));
80
- }
@@ -1,6 +0,0 @@
1
- export declare const LOGO_LINES: string[];
2
- export declare const LOGO_ROWS: number;
3
- export declare const LOGO_COLS: number;
4
- export declare const SUBTITLE = "stigg \u00B7";
5
- export declare function logoCellAt(row: number, col: number): string;
6
- export declare function isLogoCellFilled(row: number, col: number): boolean;
@@ -1,5 +0,0 @@
1
- export declare const messages: {
2
- readonly writes: {
3
- readonly abortMalformed: (file: string) => string;
4
- };
5
- };
@@ -1,6 +0,0 @@
1
- import React from "react";
2
- interface Props {
3
- onDone: () => void;
4
- }
5
- export declare function DashScreen({ onDone }: Props): React.ReactElement;
6
- export {};
@@ -1,27 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Box, Text, useInput } from "ink";
3
- import open from "open";
4
- import { useEffect, useState } from "react";
5
- import { Card } from "../components/Card.js";
6
- import { Footer } from "../components/Footer.js";
7
- const DASHBOARD_URL = "https://app.stigg.io";
8
- export function DashScreen({ onDone }) {
9
- const [phase, setPhase] = useState("opening");
10
- useEffect(() => {
11
- let cancelled = false;
12
- open(DASHBOARD_URL)
13
- .then(() => {
14
- if (!cancelled)
15
- setPhase("launched");
16
- })
17
- .catch(() => {
18
- if (!cancelled)
19
- setPhase("failed");
20
- });
21
- return () => {
22
- cancelled = true;
23
- };
24
- }, []);
25
- useInput(() => onDone());
26
- return (_jsx(Card, { title: "stigg \u00B7 cyberdeck \u00B7 dash", footer: _jsx(Footer, { hints: [{ key: "any key", label: "back to menu" }] }), children: _jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { children: ["Opening ", _jsx(Text, { color: "cyan", children: DASHBOARD_URL }), " in your browser\u2026"] }), _jsxs(Box, { marginTop: 1, children: [phase === "opening" && _jsx(Text, { dimColor: true, children: "(launching)" }), phase === "launched" && (_jsx(Text, { color: "green", children: "\u2713 Browser launched." })), phase === "failed" && (_jsx(Text, { color: "yellow", children: "Couldn't open a browser automatically \u2014 open the URL above manually." }))] }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "(placeholder \u2014 the real command will surface usage, recent entitlement events, and active subscriptions inline.)" }) })] }) }));
27
- }
@@ -1,6 +0,0 @@
1
- import React from "react";
2
- interface Props {
3
- onDone: () => void;
4
- }
5
- export declare function DebugScreen({ onDone }: Props): React.ReactElement;
6
- export {};
@@ -1,39 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Box, Text, useInput } from "ink";
3
- import { Card } from "../components/Card.js";
4
- import { Footer } from "../components/Footer.js";
5
- const SAMPLE_LOGS = [
6
- {
7
- time: "16:42:13.221",
8
- level: "INFO",
9
- source: "feature.access",
10
- message: "customer=acme_corp has_access=true plan=growth feature=ai_credits",
11
- },
12
- {
13
- time: "16:42:14.034",
14
- level: "INFO",
15
- source: "usage.report",
16
- message: "customer=acme_corp feature=api_calls value=1 source=mcp",
17
- },
18
- {
19
- time: "16:42:18.512",
20
- level: "WARN",
21
- source: "entitlement.exceeded",
22
- message: "customer=acme_corp feature=api_calls usage=1001 limit=1000 reset_at=2026-07-01",
23
- },
24
- {
25
- time: "16:42:21.118",
26
- level: "INFO",
27
- source: "subscription.updated",
28
- message: "customer=acme_corp from=growth to=growth_v2 status=active",
29
- },
30
- ];
31
- const LEVEL_COLOR = {
32
- INFO: "green",
33
- WARN: "yellow",
34
- ERROR: "red",
35
- };
36
- export function DebugScreen({ onDone }) {
37
- useInput(() => onDone());
38
- return (_jsx(Card, { title: "stigg \u00B7 cyberdeck \u00B7 debug", footer: _jsx(Footer, { hints: [{ key: "any key", label: "back to menu" }] }), children: _jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { dimColor: true, children: "Streaming audit + usage logs (placeholder, sample output)\u2026" }), _jsx(Box, { flexDirection: "column", marginTop: 1, children: SAMPLE_LOGS.map((log, i) => (_jsxs(Text, { children: [_jsx(Text, { dimColor: true, children: log.time }), " ", _jsx(Text, { color: LEVEL_COLOR[log.level], children: log.level.padEnd(5) }), " ", _jsx(Text, { color: "cyan", children: log.source.padEnd(22) }), " ", log.message] }, i))) }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "(placeholder \u2014 the real command will live-tail audit + usage events with `--since`, `--follow`, `--filter` flags.)" }) })] }) }));
39
- }
@@ -1,6 +0,0 @@
1
- import React from "react";
2
- interface Props {
3
- onDone: () => void;
4
- }
5
- export declare function InitScreen({ onDone }: Props): React.ReactElement;
6
- export {};
@@ -1,138 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Box, Text, useInput } from "ink";
3
- import { useMemo, useReducer } from "react";
4
- import { claudeCodeHandler, cursorHandler, } from "../../mcp/clients.js";
5
- import { Card } from "../components/Card.js";
6
- import { ContextRow } from "../components/ContextRow.js";
7
- import { Footer } from "../components/Footer.js";
8
- import { INITIAL_STATE, wizardReducer, } from "../state.js";
9
- import { AccountStep } from "../steps/AccountStep.js";
10
- import { ApiKeyStep } from "../steps/ApiKeyStep.js";
11
- import { ClientsStep } from "../steps/ClientsStep.js";
12
- import { CredentialKindStep } from "../steps/CredentialKindStep.js";
13
- import { EnvironmentStep } from "../steps/EnvironmentStep.js";
14
- import { LoginStep } from "../steps/LoginStep.js";
15
- import { SkillsStep } from "../steps/SkillsStep.js";
16
- import { SummaryStep } from "../steps/SummaryStep.js";
17
- import { WritingStep } from "../steps/WritingStep.js";
18
- const TITLE = "stigg · cyberdeck · init";
19
- const NAV_HINTS = [
20
- { key: "↑↓", label: "nav" },
21
- { key: "enter", label: "confirm" },
22
- { key: "esc", label: "menu" },
23
- { key: "ctrl+c", label: "quit" },
24
- ];
25
- const MULTISELECT_HINTS = [
26
- { key: "↑↓", label: "nav" },
27
- { key: "space", label: "toggle" },
28
- { key: "enter", label: "confirm" },
29
- { key: "esc", label: "menu" },
30
- { key: "ctrl+c", label: "quit" },
31
- ];
32
- const HINTS_FOR = {
33
- login: [
34
- { key: "enter", label: "continue" },
35
- { key: "esc", label: "menu" },
36
- { key: "ctrl+c", label: "cancel" },
37
- ],
38
- account: NAV_HINTS,
39
- credentialKind: NAV_HINTS,
40
- environment: NAV_HINTS,
41
- apiKey: NAV_HINTS,
42
- clients: MULTISELECT_HINTS,
43
- skills: [
44
- { key: "y/n", label: "" },
45
- { key: "esc", label: "menu" },
46
- { key: "ctrl+c", label: "quit" },
47
- ],
48
- writing: [{ key: "ctrl+c", label: "cancel" }],
49
- summary: [{ key: "any key", label: "menu" }],
50
- };
51
- function stepPath(state) {
52
- const path = ["login"];
53
- const hideAccount = state.accounts != null && state.accounts.length === 1;
54
- if (!hideAccount)
55
- path.push("account");
56
- path.push("credentialKind", "environment");
57
- if (state.credentialKind === "scoped")
58
- path.push("apiKey");
59
- path.push("clients");
60
- const hasClaudeCode = (state.selectedClients ?? []).includes("claude-code");
61
- if (hasClaudeCode)
62
- path.push("skills");
63
- path.push("writing");
64
- path.push("summary");
65
- return path;
66
- }
67
- function stepNumber(state) {
68
- const path = stepPath(state);
69
- const idx = path.indexOf(state.step);
70
- const total = path.length - 1;
71
- return { current: idx >= 0 ? idx + 1 : 1, total };
72
- }
73
- function contextEntries(state) {
74
- const entries = [];
75
- if (state.session) {
76
- entries.push({ label: "user", value: state.session.email });
77
- }
78
- if (state.account) {
79
- entries.push({ label: "account", value: state.account.displayName });
80
- }
81
- if (state.credentialKind) {
82
- entries.push({
83
- label: "credential",
84
- value: state.credentialKind === "scoped" ? "API key" : "User JWT",
85
- });
86
- }
87
- if (state.environment) {
88
- entries.push({ label: "environment", value: state.environment.name });
89
- }
90
- if (state.selectedKey) {
91
- entries.push({
92
- label: "key",
93
- value: `${state.selectedKey.name} (sk_…${state.selectedKey.lastFour})`,
94
- });
95
- }
96
- return entries;
97
- }
98
- function renderStep(state, dispatch, handlers, onDone) {
99
- switch (state.step) {
100
- case "login":
101
- return _jsx(LoginStep, { dispatch: dispatch });
102
- case "account":
103
- return _jsx(AccountStep, { state: state, dispatch: dispatch });
104
- case "credentialKind":
105
- return _jsx(CredentialKindStep, { dispatch: dispatch });
106
- case "environment":
107
- return _jsx(EnvironmentStep, { state: state, dispatch: dispatch });
108
- case "apiKey":
109
- return _jsx(ApiKeyStep, { state: state, dispatch: dispatch });
110
- case "clients":
111
- return (_jsx(ClientsStep, { state: state, dispatch: dispatch, handlers: handlers }));
112
- case "skills":
113
- return _jsx(SkillsStep, { dispatch: dispatch });
114
- case "writing":
115
- return (_jsx(WritingStep, { state: state, dispatch: dispatch, handlers: handlers }));
116
- case "summary":
117
- return _jsx(SummaryStep, { state: state, onDone: onDone });
118
- }
119
- }
120
- export function InitScreen({ onDone }) {
121
- const [state, dispatch] = useReducer(wizardReducer, INITIAL_STATE);
122
- const handlers = useMemo(() => ({
123
- "claude-code": claudeCodeHandler(),
124
- cursor: cursorHandler(),
125
- }), []);
126
- useInput((_input, key) => {
127
- if (key.escape && state.step !== "summary") {
128
- onDone();
129
- }
130
- });
131
- const { current, total } = stepNumber(state);
132
- const status = state.error != null
133
- ? "error"
134
- : state.step === "summary"
135
- ? "done"
136
- : "active";
137
- return (_jsxs(Card, { title: TITLE, subtitle: `step ${current} of ${total}`, status: status, footer: _jsx(Footer, { hints: HINTS_FOR[state.step] }), children: [_jsx(ContextRow, { entries: contextEntries(state) }), renderStep(state, dispatch, handlers, onDone), state.error && (_jsx(Box, { marginTop: 1, children: _jsxs(Text, { color: "red", children: ["\u2717 ", state.error] }) }))] }));
138
- }
@@ -1,7 +0,0 @@
1
- import React from "react";
2
- export type MenuChoice = "init" | "dash" | "debug";
3
- interface Props {
4
- onPick: (choice: MenuChoice) => void;
5
- }
6
- export declare function MenuScreen({ onPick }: Props): React.ReactElement;
7
- export {};
@@ -1,38 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Select } from "@inkjs/ui";
3
- import { Box, Text, useApp } from "ink";
4
- import { Card } from "../components/Card.js";
5
- import { Footer } from "../components/Footer.js";
6
- const OPTIONS = [
7
- {
8
- value: "init",
9
- label: "init Set up Stigg in this project — auth, MCP config, skills",
10
- },
11
- {
12
- value: "dash",
13
- label: "dash Open the Stigg dashboard in your browser",
14
- },
15
- {
16
- value: "debug",
17
- label: "debug Stream Stigg audit + usage logs (placeholder)",
18
- },
19
- {
20
- value: "exit",
21
- label: "exit Quit cyberdeck",
22
- },
23
- ];
24
- const HINTS = [
25
- { key: "↑↓", label: "nav" },
26
- { key: "enter", label: "confirm" },
27
- { key: "ctrl+c", label: "quit" },
28
- ];
29
- export function MenuScreen({ onPick }) {
30
- const { exit } = useApp();
31
- return (_jsxs(Card, { title: "stigg \u00B7 cyberdeck", footer: _jsx(Footer, { hints: HINTS }), children: [_jsx(Box, { marginBottom: 1, children: _jsx(Text, { children: "What do you want to do?" }) }), _jsx(Select, { options: OPTIONS, onChange: (value) => {
32
- if (value === "exit") {
33
- exit();
34
- return;
35
- }
36
- onPick(value);
37
- } })] }));
38
- }
@@ -1,72 +0,0 @@
1
- import type { InstallResult as SkillsInstallResult } from '../skills/install.js';
2
- import type { Account, ApiKey, ClientId, Credential, Environment, Session, WriteResult } from '../types.js';
3
- export type StepId = 'login' | 'account' | 'environment' | 'apiKey' | 'clients' | 'skills' | 'writing' | 'summary';
4
- export type { ApiKey };
5
- export interface WizardState {
6
- step: StepId;
7
- history: StepId[];
8
- session?: Session;
9
- accounts?: Account[];
10
- account?: Account;
11
- environments?: Environment[];
12
- environment?: Environment;
13
- apiKeys?: ApiKey[];
14
- selectedKey?: ApiKey;
15
- credential?: Credential;
16
- detectedClients?: ClientId[];
17
- selectedClients?: ClientId[];
18
- installSkills?: boolean;
19
- writes: WriteResult[];
20
- installedSkills?: SkillsInstallResult;
21
- error?: string;
22
- }
23
- export type Action = {
24
- type: 'LOGIN_OK';
25
- session: Session;
26
- } | {
27
- type: 'ACCOUNTS_LOADED';
28
- accounts: Account[];
29
- } | {
30
- type: 'PICK_ACCOUNT';
31
- account: Account;
32
- } | {
33
- type: 'ENVS_LOADED';
34
- environments: Environment[];
35
- } | {
36
- type: 'PICK_ENV';
37
- environment: Environment;
38
- } | {
39
- type: 'KEYS_LOADED';
40
- apiKeys: ApiKey[];
41
- } | {
42
- type: 'PICK_KEY';
43
- key: ApiKey;
44
- credentialValue: string;
45
- } | {
46
- type: 'DETECT_OK';
47
- clients: ClientId[];
48
- } | {
49
- type: 'PICK_CLIENTS';
50
- clients: ClientId[];
51
- } | {
52
- type: 'SKILLS_CHOICE';
53
- install: boolean;
54
- } | {
55
- type: 'WRITE_OK';
56
- result: WriteResult;
57
- } | {
58
- type: 'SKILLS_INSTALL_OK';
59
- result: SkillsInstallResult;
60
- } | {
61
- type: 'ADVANCE';
62
- } | {
63
- type: 'BACK';
64
- } | {
65
- type: 'ERROR';
66
- message: string;
67
- } | {
68
- type: 'RESET';
69
- };
70
- export declare const INITIAL_STATE: WizardState;
71
- export declare function nextStep(step: StepId, selectedClients: ClientId[] | undefined): StepId;
72
- export declare function wizardReducer(state: WizardState, action: Action): WizardState;
@@ -1,8 +0,0 @@
1
- import React from "react";
2
- import type { Action, WizardState } from "../state.js";
3
- interface Props {
4
- state: WizardState;
5
- dispatch: React.Dispatch<Action>;
6
- }
7
- export declare function AccountStep({ state, dispatch }: Props): React.ReactElement;
8
- export {};
@@ -1,42 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Select, Spinner } from "@inkjs/ui";
3
- import { Box } from "ink";
4
- import { useEffect } from "react";
5
- import { listAccounts } from "../../api/client.js";
6
- import { SectionTitle } from "../components/SectionTitle.js";
7
- import { useAsyncEffect } from "../hooks/useAsyncEffect.js";
8
- export function AccountStep({ state, dispatch }) {
9
- useAsyncEffect(async (signal) => {
10
- if (state.accounts || !state.session)
11
- return;
12
- const accounts = await listAccounts(state.session.accessToken);
13
- if (signal.cancelled)
14
- return;
15
- dispatch({ type: "ACCOUNTS_LOADED", accounts });
16
- }, [state.session?.accessToken], (err) => dispatch({
17
- type: "ERROR",
18
- message: err instanceof Error ? err.message : String(err),
19
- }));
20
- useEffect(() => {
21
- if (state.accounts &&
22
- state.accounts.length === 1 &&
23
- !state.account &&
24
- state.step === "account") {
25
- dispatch({ type: "PICK_ACCOUNT", account: state.accounts[0] });
26
- }
27
- }, [state.accounts, state.account, state.step, dispatch]);
28
- if (!state.accounts) {
29
- return _jsx(Spinner, { label: "Loading accounts\u2026" });
30
- }
31
- if (state.accounts.length === 1) {
32
- return _jsx(Spinner, { label: `Using ${state.accounts[0].displayName}…` });
33
- }
34
- return (_jsxs(Box, { flexDirection: "column", children: [_jsx(SectionTitle, { children: "Which account?" }), _jsx(Select, { options: state.accounts.map((a) => ({
35
- label: a.displayName,
36
- value: a.id,
37
- })), onChange: (v) => {
38
- const account = state.accounts?.find((a) => a.id === v);
39
- if (account)
40
- dispatch({ type: "PICK_ACCOUNT", account });
41
- } })] }));
42
- }
@@ -1,8 +0,0 @@
1
- import React from "react";
2
- import type { Action, WizardState } from "../state.js";
3
- interface Props {
4
- state: WizardState;
5
- dispatch: React.Dispatch<Action>;
6
- }
7
- export declare function ApiKeyStep({ state, dispatch }: Props): React.ReactElement;
8
- export {};