@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,6 +0,0 @@
1
- export interface SkillsAddOptions {
2
- client?: string[];
3
- all?: boolean;
4
- json?: boolean;
5
- }
6
- export declare function skillsAddCommand(opts?: SkillsAddOptions): Promise<void>;
@@ -1,19 +0,0 @@
1
- import type { ClientId } from '../types.js';
2
- export interface HostAgent {
3
- /** The MCP client ID this agent corresponds to. */
4
- id: ClientId;
5
- /** Human-readable display name. */
6
- name: string;
7
- /** Agent-specific one-line restart instruction (without the leading ⚠ marker). */
8
- restartHint: string;
9
- }
10
- /**
11
- * Detect which AI agent (if any) is hosting this CLI invocation, based on
12
- * env vars that each agent sets when it spawns shell commands.
13
- *
14
- * Priority: STIGG_HOST_AGENT override > Claude Code > Cursor > Codex > VS Code > null.
15
- *
16
- * Detection is best-effort — a false negative just falls back to the generic
17
- * restart line and `--all` client default.
18
- */
19
- export declare function detectHostAgent(): HostAgent | null;
@@ -1,9 +0,0 @@
1
- export interface PhaseOneOptions {
2
- forceLogin?: boolean;
3
- callbackPort?: number;
4
- client?: string[];
5
- all?: boolean;
6
- installSkills?: boolean;
7
- json?: boolean;
8
- }
9
- export declare function runInitPhase1(opts?: PhaseOneOptions): Promise<void>;
@@ -1,36 +0,0 @@
1
- import type { AuthSession } from '../auth/oauth.js';
2
- import type { Account, ApiKey, Environment } from '../types.js';
3
- export interface PhaseTwoOptions {
4
- accountId: string;
5
- environmentId: string;
6
- apiKeyId: string;
7
- client?: string[];
8
- all?: boolean;
9
- installSkills: boolean;
10
- json?: boolean;
11
- }
12
- export interface FinalizeContext {
13
- session: AuthSession;
14
- account: Account;
15
- env: Environment;
16
- envs: Environment[];
17
- apiKey: ApiKey;
18
- }
19
- export interface FinalizeOptions {
20
- client?: string[];
21
- all?: boolean;
22
- installSkills: boolean;
23
- json?: boolean;
24
- }
25
- export declare function runInitPhase2(opts: PhaseTwoOptions): Promise<void>;
26
- /**
27
- * Complete the setup using fully-resolved (account, env, apiKey).
28
- * Used by `runInitPhase2` after validating CLI flags, and by `runInitPhase1`
29
- * after auto-picking when there's exactly one of each.
30
- *
31
- * Does NOT call `process.exit`. Returns the success flag for the caller to
32
- * decide on exit code.
33
- */
34
- export declare function finalizeInitSetup(ctx: FinalizeContext, opts: FinalizeOptions): Promise<{
35
- ok: boolean;
36
- }>;
@@ -1,7 +0,0 @@
1
- import type { HostAgent } from './host-agent.js';
2
- /**
3
- * One-line restart instruction tailored to the host agent if known, else generic.
4
- * Returned without the leading ⚠ marker — the caller decides how to surface it.
5
- */
6
- export declare function restartHint(hostAgent: HostAgent | null): string;
7
- export declare function nextStepPrompt(envName: string): string;
@@ -1,30 +0,0 @@
1
- import type { ClientId } from '../types.js';
2
- import type { HostAgent } from './host-agent.js';
3
- export type ClientSelection = {
4
- kind: 'all';
5
- } | {
6
- kind: 'explicit';
7
- ids: ClientId[];
8
- };
9
- export declare class HeadlessOptionsError extends Error {
10
- constructor(message: string);
11
- }
12
- export interface ClientFlagOptions {
13
- client?: string[];
14
- all?: boolean;
15
- }
16
- export declare function validClientIds(): ClientId[];
17
- export declare function parseClientSelection(opts: ClientFlagOptions, { required }?: {
18
- required?: boolean;
19
- }): ClientSelection;
20
- export declare function requireApiKey(flagValue?: string): string;
21
- /**
22
- * Resolve the client selection for `init --headless` (phase 2), applying the
23
- * host-agent fallback when neither `--client` nor `--all` is explicit.
24
- *
25
- * Priority: explicit flag (>--client or --all) > host agent > all detected.
26
- *
27
- * Used only by `init` — standalone `mcp add` / `skills add` keep the strict
28
- * "explicit required" rule via `parseClientSelection({ required: true })`.
29
- */
30
- export declare function resolveClientSelectionForInit(opts: ClientFlagOptions, hostAgent: HostAgent | null): ClientSelection;
@@ -1,16 +0,0 @@
1
- export interface Reporter {
2
- /** Write a progress line to stdout. JSON reporter no-ops. */
3
- human(line: string): void;
4
- /** Write a failure line to stderr. Both reporters write this. */
5
- stderr(line: string): void;
6
- /** Emit the final structured payload. Human reporter no-ops; JSON reporter prints JSON. */
7
- emit(payload: Record<string, unknown>): void;
8
- }
9
- export declare const fmt: {
10
- heading(text: string): string;
11
- ok(text: string, detail?: string): string;
12
- fail(text: string, reason?: string): string;
13
- };
14
- export declare function createReporter(opts: {
15
- json?: boolean;
16
- }): Reporter;
@@ -1,29 +0,0 @@
1
- import { type InstallResult as SkillsInstallResult } from '../skills/install.js';
2
- import type { ClientId, WriteResult } from '../types.js';
3
- import { type ClientSelection } from './options.js';
4
- export interface SkippedClient {
5
- id: ClientId;
6
- reason: 'unsupported' | 'unknown';
7
- }
8
- export interface HeadlessSetupOptions {
9
- apiKey: string;
10
- clients: ClientSelection;
11
- installSkills: boolean;
12
- /** Skip the MCP loop entirely. Used by `skills add`. */
13
- skipMcp?: boolean;
14
- }
15
- export interface HeadlessResult {
16
- writes: WriteResult[];
17
- skipped: SkippedClient[];
18
- skillsInstall?: SkillsInstallResult;
19
- ok: boolean;
20
- }
21
- export interface ProgressCallbacks {
22
- onClientResult?: (write: WriteResult, client: {
23
- id: ClientId;
24
- name: string;
25
- }) => void;
26
- onClientFail?: (id: ClientId, name: string, reason: string) => void;
27
- onSkillsResult?: (result: SkillsInstallResult) => void;
28
- }
29
- export declare function runHeadlessSetup(opts: HeadlessSetupOptions, progress?: ProgressCallbacks): Promise<HeadlessResult>;
@@ -1,55 +0,0 @@
1
- import type { HostAgent } from '../headless/host-agent.js';
2
- import type { ClientId } from '../types.js';
3
- /**
4
- * The subset of {@link ClientId}s we can launch as a foreground CLI agent that
5
- * inherits this terminal. GUI clients (`claude-desktop`, `vscode`) are excluded —
6
- * they can't take over the TTY.
7
- */
8
- export type LaunchableAgentId = 'claude-code' | 'codex' | 'cursor';
9
- export interface LaunchableAgent {
10
- id: LaunchableAgentId;
11
- name: string;
12
- }
13
- export interface LaunchRequest {
14
- agentId: LaunchableAgentId;
15
- /** Seed message passed to the agent as its first user turn. */
16
- prompt: string;
17
- /** When true, pass the agent's permission-bypass flag. */
18
- skipPermissions: boolean;
19
- }
20
- export declare function agentName(id: LaunchableAgentId): string;
21
- export declare function skipPermissionFlag(id: LaunchableAgentId): string;
22
- /**
23
- * Resolve the launch binary for an agent, or `null` when it isn't available.
24
- *
25
- * - `claude-code` reuses {@link findClaudeBinary} (known install paths + PATH,
26
- * honoring `STIGG_CLAUDE_BINARY`).
27
- * - `codex` / `cursor` honor a `STIGG_*_BINARY` override (unset → real lookup,
28
- * empty string → treat as not found, any other value → that path) and
29
- * otherwise probe PATH. Note this is independent of the MCP client's
30
- * `isClientSupported()` — e.g. Cursor the IDE can be installed without the
31
- * `cursor-agent` CLI being on PATH.
32
- */
33
- export declare function resolveAgentBinary(id: LaunchableAgentId): string | null;
34
- /** All agents whose launch binary is currently resolvable, in preference order. */
35
- export declare function listLaunchableAgents(): LaunchableAgent[];
36
- /**
37
- * Pick which agent to preselect in the launch picker: the host agent if it's
38
- * launchable, else the first configured client that's launchable, else the
39
- * first available agent. Returns `undefined` only when nothing is launchable.
40
- */
41
- export declare function chooseDefaultAgent(hostAgent: HostAgent | null, selectedClients: ClientId[] | undefined, launchable: LaunchableAgent[]): LaunchableAgentId | undefined;
42
- /**
43
- * Spawn the agent so it inherits this terminal, seeded with `prompt` as its
44
- * first user message. Resolves with the child's exit code; rejects if the
45
- * binary can't be found or fails to spawn.
46
- *
47
- * MUST be called only after the Ink TUI has fully unmounted and restored the
48
- * terminal (see `start-tui.ts`) — never while Ink owns the TTY.
49
- */
50
- export declare function launchAgent(req: LaunchRequest): Promise<number>;
51
- /**
52
- * Best-effort copy to the system clipboard. Resolves `false` when no clipboard
53
- * tool is available (the caller should then fall back to showing the text).
54
- */
55
- export declare function copyPromptToClipboard(text: string): Promise<boolean>;
@@ -1,49 +0,0 @@
1
- import type { ClientId, Credential, WriteResult } from '../../types.js';
2
- import { type McpServerConfig } from '../writer.js';
3
- export declare const STIGG_MCP_URL = "https://mcp.stigg.io";
4
- export declare const STIGG_SERVER_NAME = "stigg";
5
- export type { McpServerConfig };
6
- export interface InstallResult {
7
- ok: boolean;
8
- /** File path for JSON/TOML installs, or a label like "claude mcp add" for CLI installs. */
9
- target: string;
10
- /** Set when an existing entry was backed up before overwrite. */
11
- backedUpTo?: string;
12
- /** Present iff ok=false. */
13
- reason?: string;
14
- }
15
- export declare abstract class McpClient {
16
- abstract readonly id: ClientId;
17
- abstract readonly name: string;
18
- /** Human-readable short label for the picker (typically the config path or the CLI command). */
19
- abstract installTarget(): string;
20
- /** Is this client installed/usable on this machine? */
21
- abstract isClientSupported(): Promise<boolean>;
22
- /** Does this client already have a Stigg MCP entry? */
23
- abstract hasExistingEntry(): Promise<boolean>;
24
- /** Install or overwrite the Stigg MCP entry for this client. */
25
- abstract addServer(credential: Credential): Promise<InstallResult>;
26
- /** Remove the Stigg MCP entry, if any. */
27
- abstract removeServer(): Promise<InstallResult>;
28
- /** Map an InstallResult to the WriteResult shape used by the wizard. */
29
- toWriteResult(r: InstallResult): WriteResult;
30
- }
31
- /**
32
- * Concrete template for clients whose config is "edit JSON at a known path
33
- * and put an entry under <propertyName>.<serverName>". Subclasses override:
34
- * - getConfigPath() — required
35
- * - getServerConfig() — required (the entry shape)
36
- * - getServerPropertyName() — optional, defaults to "mcpServers"
37
- */
38
- export declare abstract class DefaultJsonMcpClient extends McpClient {
39
- protected readonly serverName = "stigg";
40
- abstract getConfigPath(): string;
41
- abstract getServerConfig(credential: Credential): McpServerConfig;
42
- getServerPropertyName(): string;
43
- installTarget(): string;
44
- hasExistingEntry(): Promise<boolean>;
45
- addServer(credential: Credential): Promise<InstallResult>;
46
- removeServer(): Promise<InstallResult>;
47
- }
48
- export declare function prettifyPath(p: string): string;
49
- export declare function errorMessage(e: unknown): string;
@@ -1,22 +0,0 @@
1
- import type { ClientId, Credential } from '../../types.js';
2
- import { type InstallResult, McpClient } from './base.js';
3
- /**
4
- * Locate the `claude` CLI binary using PostHog wizard's lookup order:
5
- * three known install paths, then the shell PATH. Cached for the
6
- * lifetime of the process.
7
- *
8
- * Tests can short-circuit via STIGG_CLAUDE_BINARY:
9
- * - unset → real lookup (default)
10
- * - empty string → behave as if not found
11
- * - any other value → that string is returned as the binary
12
- */
13
- export declare function findClaudeBinary(): string | null;
14
- export declare class ClaudeCodeMcpClient extends McpClient {
15
- readonly id: ClientId;
16
- readonly name = "Claude Code";
17
- installTarget(): string;
18
- isClientSupported(): Promise<boolean>;
19
- hasExistingEntry(): Promise<boolean>;
20
- addServer(credential: Credential): Promise<InstallResult>;
21
- removeServer(): Promise<InstallResult>;
22
- }
@@ -1,9 +0,0 @@
1
- import type { ClientId, Credential } from '../../types.js';
2
- import { DefaultJsonMcpClient, type McpServerConfig } from './base.js';
3
- export declare class ClaudeDesktopMcpClient extends DefaultJsonMcpClient {
4
- readonly id: ClientId;
5
- readonly name = "Claude Desktop";
6
- getConfigPath(): string;
7
- isClientSupported(): Promise<boolean>;
8
- getServerConfig(credential: Credential): McpServerConfig;
9
- }
@@ -1,13 +0,0 @@
1
- import type { ClientId, Credential } from '../../types.js';
2
- import { type InstallResult, McpClient } from './base.js';
3
- export declare class CodexMcpClient extends McpClient {
4
- readonly id: ClientId;
5
- readonly name = "Codex";
6
- private readonly serverName;
7
- installTarget(): string;
8
- getConfigPath(): string;
9
- isClientSupported(): Promise<boolean>;
10
- hasExistingEntry(): Promise<boolean>;
11
- addServer(credential: Credential): Promise<InstallResult>;
12
- removeServer(): Promise<InstallResult>;
13
- }
@@ -1,9 +0,0 @@
1
- import type { ClientId, Credential } from '../../types.js';
2
- import { DefaultJsonMcpClient, type McpServerConfig } from './base.js';
3
- export declare class CursorMcpClient extends DefaultJsonMcpClient {
4
- readonly id: ClientId;
5
- readonly name = "Cursor";
6
- getConfigPath(): string;
7
- isClientSupported(): Promise<boolean>;
8
- getServerConfig(credential: Credential): McpServerConfig;
9
- }
@@ -1,7 +0,0 @@
1
- import type { ClientId } from '../../types.js';
2
- import type { McpClient } from './base.js';
3
- export type { InstallResult, McpServerConfig } from './base.js';
4
- export { McpClient, DefaultJsonMcpClient } from './base.js';
5
- export declare function getAllClients(): readonly McpClient[];
6
- export declare function getClientById(id: ClientId): McpClient | undefined;
7
- export declare function getSupportedClients(): Promise<McpClient[]>;
@@ -1,11 +0,0 @@
1
- import type { Credential } from '../../types.js';
2
- /**
3
- * Build a stdio-via-mcp-remote MCP entry for clients that don't speak HTTP
4
- * natively (Claude Desktop, Codex). The API key is passed through an env
5
- * var so it doesn't appear in the command's `args` array.
6
- */
7
- export declare function buildMcpRemoteEntry(credential: Credential): {
8
- command: string;
9
- args: string[];
10
- env: Record<string, string>;
11
- };
@@ -1,17 +0,0 @@
1
- import type { ClientId, Credential } from '../../types.js';
2
- import { DefaultJsonMcpClient, type InstallResult, type McpServerConfig } from './base.js';
3
- export declare class VsCodeMcpClient extends DefaultJsonMcpClient {
4
- readonly id: ClientId;
5
- readonly name = "Visual Studio Code";
6
- getConfigPath(): string;
7
- getServerPropertyName(): string;
8
- isClientSupported(): Promise<boolean>;
9
- getServerConfig(credential: Credential): McpServerConfig;
10
- /**
11
- * Prefer `code --add-mcp '<json>'` when the `code` CLI is on PATH —
12
- * that's the canonical entry point. Fall back to a direct file edit
13
- * otherwise (typical when the user hasn't run "Install 'code' command
14
- * in PATH" from the command palette).
15
- */
16
- addServer(credential: Credential): Promise<InstallResult>;
17
- }
@@ -1,4 +0,0 @@
1
- import type { ClientId, McpClientHandler } from "../types.js";
2
- export declare function claudeCodeHandler(): McpClientHandler;
3
- export declare function cursorHandler(): McpClientHandler;
4
- export declare function detectClients(handlers: Record<ClientId, McpClientHandler>): Promise<ClientId[]>;
@@ -1,50 +0,0 @@
1
- import { access, constants } from "node:fs/promises";
2
- import { homedir } from "node:os";
3
- import { join } from "node:path";
4
- import { optionalEnv } from "../auth/config.js";
5
- import { buildMcpEntry, hasMcpEntry, writeMcpEntry } from "./writer.js";
6
- const DEFAULT_URL = "https://mcp.stigg.io";
7
- const SERVER_NAME = "stigg";
8
- function mcpUrl() {
9
- return optionalEnv("STIGG_MCP_URL") ?? DEFAULT_URL;
10
- }
11
- function claudeCodeConfigPath() {
12
- return (optionalEnv("STIGG_CLAUDE_CONFIG") ?? join(homedir(), ".claude.json"));
13
- }
14
- function cursorConfigPath() {
15
- return (optionalEnv("STIGG_CURSOR_CONFIG") ??
16
- join(homedir(), ".cursor", "mcp.json"));
17
- }
18
- function pathExists(path) {
19
- return access(path, constants.F_OK).then(() => true, () => false);
20
- }
21
- export function claudeCodeHandler() {
22
- const path = claudeCodeConfigPath();
23
- return {
24
- id: "claude-code",
25
- label: "~/.claude.json",
26
- configPath: path,
27
- hasExistingEntry: () => hasMcpEntry(path, SERVER_NAME),
28
- write: (credential) => writeMcpEntry(path, SERVER_NAME, buildMcpEntry(credential, mcpUrl())),
29
- isInstalled: () => pathExists(path).then((ok) => ok ? true : pathExists(join(homedir(), ".claude"))),
30
- };
31
- }
32
- export function cursorHandler() {
33
- const path = cursorConfigPath();
34
- return {
35
- id: "cursor",
36
- label: "~/.cursor/mcp.json",
37
- configPath: path,
38
- hasExistingEntry: () => hasMcpEntry(path, SERVER_NAME),
39
- write: (credential) => writeMcpEntry(path, SERVER_NAME, buildMcpEntry(credential, mcpUrl())),
40
- isInstalled: () => pathExists(join(homedir(), ".cursor")),
41
- };
42
- }
43
- export async function detectClients(handlers) {
44
- const ids = [];
45
- for (const handler of Object.values(handlers)) {
46
- if (await handler.isInstalled())
47
- ids.push(handler.id);
48
- }
49
- return ids;
50
- }
@@ -1,9 +0,0 @@
1
- import * as jsonc from 'jsonc-parser';
2
- export declare class ConfigParseError extends Error {
3
- path: string;
4
- detail: jsonc.ParseError[] | string;
5
- constructor(path: string, detail: jsonc.ParseError[] | string);
6
- }
7
- export declare function parseStrict(text: string, path: string): Record<string, unknown>;
8
- export declare function setJsonPath(text: string, path: jsonc.JSONPath, value: unknown): string;
9
- export declare function readJsonPath(value: unknown, path: readonly (string | number)[]): unknown;
@@ -1,6 +0,0 @@
1
- import type { WriteResult } from '../types.js';
2
- export type { WriteResult };
3
- export type McpServerConfig = Record<string, unknown>;
4
- export declare function hasMcpEntry(path: string, propertyName: string, serverName: string): Promise<boolean>;
5
- export declare function writeMcpEntry(path: string, propertyName: string, serverName: string, entry: McpServerConfig): Promise<WriteResult>;
6
- export declare function removeMcpEntry(path: string, propertyName: string, serverName: string): Promise<WriteResult>;
@@ -1,21 +0,0 @@
1
- import type { ClientId, Environment } from '../types.js';
2
- export interface SetupInfo {
3
- user: string;
4
- account: string;
5
- accountId: string;
6
- environment: string;
7
- environmentId: string;
8
- credentialLabel: string;
9
- /** Snapshot of all environments visible at init time. Used by the env
10
- * switcher so it can render the picker without an extra API round-trip. */
11
- environments?: Environment[];
12
- /** Clients we wrote an MCP entry to, so the env switcher knows which
13
- * configs to rewrite without re-detecting. */
14
- clients?: ClientId[];
15
- completedAt: string;
16
- }
17
- export declare function setupConfigDir(): string;
18
- export declare function setupPath(): string;
19
- export declare function saveSetup(info: SetupInfo): Promise<string>;
20
- export declare function loadSetup(): Promise<SetupInfo | null>;
21
- export declare function clearSetup(): Promise<void>;
@@ -1,19 +0,0 @@
1
- import type { ClientId } from '../types.js';
2
- export interface SubResult {
3
- ok: boolean;
4
- reason?: string;
5
- }
6
- export interface InstallResult {
7
- /** Result of `claude plugin install stigg@stigg-marketplace` (Claude Code path). */
8
- claudeCode?: SubResult;
9
- /** Result of `npx skills add stiggio/skills --all` (Agent Skills format, multi-client). */
10
- agentSkills?: SubResult;
11
- /** Convenience boolean — true iff every attempted sub-step succeeded. */
12
- ok: boolean;
13
- }
14
- /**
15
- * Install Stigg skills using the right canonical path for each client family.
16
- * Claude Code → `claude plugin marketplace add` + `claude plugin install`.
17
- * Anything else that consumes the Agent Skills format → `npx skills add`.
18
- */
19
- export declare function installStiggSkills(selectedClients: ClientId[]): Promise<InstallResult>;
package/dist/types.d.ts DELETED
@@ -1,35 +0,0 @@
1
- export type ClientId = 'claude-code' | 'cursor' | 'claude-desktop' | 'vscode' | 'codex';
2
- export interface Credential {
3
- value: string;
4
- accountId?: string;
5
- environmentId?: string;
6
- environmentSlug?: string;
7
- }
8
- export interface Account {
9
- id: string;
10
- displayName: string;
11
- }
12
- export interface Environment {
13
- id: string;
14
- name: string;
15
- slug?: string;
16
- }
17
- export interface Session {
18
- email: string;
19
- accessToken: string;
20
- }
21
- export interface ApiKey {
22
- id: string;
23
- name: string;
24
- lastFour: string;
25
- scopes: string[];
26
- keyType: string;
27
- createdAt: string;
28
- value?: string;
29
- }
30
- export interface WriteResult {
31
- path: string;
32
- client?: ClientId;
33
- written: boolean;
34
- backedUpTo?: string;
35
- }
@@ -1,11 +0,0 @@
1
- import React from "react";
2
- export type CardStatus = "active" | "done" | "error";
3
- interface CardProps {
4
- title: string;
5
- subtitle?: string;
6
- status?: CardStatus;
7
- children: React.ReactNode;
8
- footer?: React.ReactNode;
9
- }
10
- export declare function Card({ title, subtitle, status, children, footer, }: CardProps): React.ReactElement;
11
- export {};
@@ -1,19 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Box, Text } from "ink";
3
- import { COLORS, GLYPHS, shouldRenderBorder } from "../theme.js";
4
- const STATUS_GLYPH = {
5
- active: "",
6
- done: GLYPHS.check,
7
- error: GLYPHS.cross,
8
- };
9
- const STATUS_COLOR = {
10
- active: COLORS.primary,
11
- done: COLORS.success,
12
- error: COLORS.error,
13
- };
14
- export function Card({ title, subtitle, status = "active", children, footer, }) {
15
- const useBorder = shouldRenderBorder();
16
- const borderColor = STATUS_COLOR[status];
17
- const glyph = STATUS_GLYPH[status];
18
- return (_jsxs(Box, { flexDirection: "column", width: "100%", borderStyle: useBorder ? "round" : undefined, borderColor: borderColor, paddingX: useBorder ? 1 : 0, children: [_jsxs(Box, { justifyContent: "space-between", children: [_jsx(Text, { color: borderColor, bold: true, children: title }), _jsxs(Box, { children: [subtitle && _jsx(Text, { dimColor: true, children: subtitle }), glyph && (_jsxs(Text, { color: borderColor, children: [subtitle ? " " : "", glyph] }))] })] }), _jsx(Box, { flexDirection: "column", marginTop: 1, children: children }), footer] }));
19
- }
@@ -1,11 +0,0 @@
1
- import React from "react";
2
- export interface ContextEntry {
3
- label: string;
4
- value: string;
5
- hint?: string;
6
- }
7
- interface ContextRowProps {
8
- entries: ContextEntry[];
9
- }
10
- export declare function ContextRow({ entries }: ContextRowProps): React.ReactElement;
11
- export {};
@@ -1,8 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Box, Text } from "ink";
3
- export function ContextRow({ entries }) {
4
- if (entries.length === 0)
5
- return _jsx(Box, {});
6
- const labelWidth = Math.max(...entries.map((e) => e.label.length));
7
- return (_jsx(Box, { flexDirection: "column", marginBottom: 1, children: entries.map((entry, i) => (_jsxs(Box, { children: [_jsx(Box, { width: labelWidth + 2, children: _jsx(Text, { dimColor: true, children: entry.label }) }), _jsx(Text, { children: entry.value }), entry.hint && (_jsxs(Text, { dimColor: true, children: [" ", entry.hint] }))] }, `${entry.label}-${i}`))) }));
8
- }
@@ -1,10 +0,0 @@
1
- import React from "react";
2
- export interface KeyHint {
3
- key: string;
4
- label: string;
5
- }
6
- interface FooterProps {
7
- hints: KeyHint[];
8
- }
9
- export declare function Footer({ hints }: FooterProps): React.ReactElement;
10
- export {};
@@ -1,9 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Box, Text } from "ink";
3
- import React from "react";
4
- import { GLYPHS } from "../theme.js";
5
- export function Footer({ hints }) {
6
- if (hints.length === 0)
7
- return _jsx(Box, {});
8
- return (_jsx(Box, { marginTop: 1, children: hints.map((hint, i) => (_jsxs(React.Fragment, { children: [i > 0 && (_jsxs(Text, { dimColor: true, children: [" ", GLYPHS.bullet, " "] })), _jsx(Text, { color: "cyan", children: hint.key }), _jsxs(Text, { dimColor: true, children: [" ", hint.label] })] }, `${hint.key}-${i}`))) }));
9
- }
@@ -1,11 +0,0 @@
1
- import React from "react";
2
- interface HeaderProps {
3
- title: string;
4
- step?: {
5
- current: number;
6
- total: number;
7
- };
8
- badge?: string;
9
- }
10
- export declare function Header({ title, step, badge }: HeaderProps): React.ReactElement;
11
- export {};
@@ -1,6 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Box, Text } from "ink";
3
- import { COLORS } from "../theme.js";
4
- export function Header({ title, step, badge }) {
5
- return (_jsxs(Box, { justifyContent: "space-between", marginBottom: 1, children: [_jsx(Text, { bold: true, color: COLORS.primary, children: title }), _jsxs(Box, { children: [step && (_jsxs(Text, { dimColor: true, children: ["step ", step.current, " of ", step.total] })), badge && (_jsxs(Text, { color: "cyan", children: [step ? " " : "", badge] }))] })] }));
6
- }
@@ -1,13 +0,0 @@
1
- import React from "react";
2
- export type DiffLineKind = "add" | "remove" | "context" | "header";
3
- export interface DiffLine {
4
- kind: DiffLineKind;
5
- text: string;
6
- }
7
- interface JsonPreviewProps {
8
- lines: DiffLine[];
9
- title?: string;
10
- }
11
- export declare function JsonPreview({ lines, title, }: JsonPreviewProps): React.ReactElement;
12
- export declare function jsonToDiffLines(entry: unknown, serverName: string): DiffLine[];
13
- export {};