@straion/cli 0.0.2 → 0.0.3

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 (139) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +0 -4
  3. package/dist/cli.d.ts +0 -4
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +3 -7
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/default.d.ts +1 -2
  8. package/dist/commands/default.d.ts.map +1 -1
  9. package/dist/commands/default.js +7 -42
  10. package/dist/commands/default.js.map +1 -1
  11. package/dist/commands/find-requirements.d.ts.map +1 -1
  12. package/dist/commands/find-requirements.integration.test.js +17 -56
  13. package/dist/commands/find-requirements.integration.test.js.map +1 -1
  14. package/dist/commands/find-requirements.js +20 -32
  15. package/dist/commands/find-requirements.js.map +1 -1
  16. package/dist/commands/index.d.ts.map +1 -1
  17. package/dist/commands/index.js +2 -0
  18. package/dist/commands/index.js.map +1 -1
  19. package/dist/commands/login.d.ts.map +1 -1
  20. package/dist/commands/login.integration.test.js +21 -142
  21. package/dist/commands/login.integration.test.js.map +1 -1
  22. package/dist/commands/login.js +10 -4
  23. package/dist/commands/login.js.map +1 -1
  24. package/dist/commands/logout.d.ts.map +1 -1
  25. package/dist/commands/logout.js +7 -22
  26. package/dist/commands/logout.js.map +1 -1
  27. package/dist/commands/session-start.d.ts.map +1 -1
  28. package/dist/commands/session-start.js +1 -8
  29. package/dist/commands/session-start.js.map +1 -1
  30. package/dist/commands/setup.d.ts +3 -0
  31. package/dist/commands/setup.d.ts.map +1 -0
  32. package/dist/commands/setup.js +23 -0
  33. package/dist/commands/setup.js.map +1 -0
  34. package/dist/components/banner.d.ts +3 -0
  35. package/dist/components/banner.d.ts.map +1 -0
  36. package/dist/components/banner.js +13 -0
  37. package/dist/components/banner.js.map +1 -0
  38. package/dist/components/default-flow.d.ts +11 -0
  39. package/dist/components/default-flow.d.ts.map +1 -0
  40. package/dist/components/default-flow.js +64 -0
  41. package/dist/components/default-flow.js.map +1 -0
  42. package/dist/components/hero.d.ts.map +1 -1
  43. package/dist/components/hero.js +22 -28
  44. package/dist/components/hero.js.map +1 -1
  45. package/dist/components/login/login-error.d.ts.map +1 -1
  46. package/dist/components/login/login-error.js +2 -4
  47. package/dist/components/login/login-error.js.map +1 -1
  48. package/dist/components/login/login-flow.d.ts +3 -3
  49. package/dist/components/login/login-flow.d.ts.map +1 -1
  50. package/dist/components/login/login-flow.js +19 -49
  51. package/dist/components/login/login-flow.js.map +1 -1
  52. package/dist/components/login/login-flow.test.js +8 -8
  53. package/dist/components/login/login-flow.test.js.map +1 -1
  54. package/dist/components/login/user-settings-link.d.ts +3 -0
  55. package/dist/components/login/user-settings-link.d.ts.map +1 -0
  56. package/dist/components/login/user-settings-link.js +8 -0
  57. package/dist/components/login/user-settings-link.js.map +1 -0
  58. package/dist/components/multi-select.d.ts +16 -0
  59. package/dist/components/multi-select.d.ts.map +1 -0
  60. package/dist/components/multi-select.js +105 -0
  61. package/dist/components/multi-select.js.map +1 -0
  62. package/dist/components/org-selector.d.ts.map +1 -1
  63. package/dist/components/org-selector.js +3 -1
  64. package/dist/components/org-selector.js.map +1 -1
  65. package/dist/components/pat-input.js +1 -1
  66. package/dist/components/pat-input.js.map +1 -1
  67. package/dist/components/setup/agent-setup.d.ts +9 -0
  68. package/dist/components/setup/agent-setup.d.ts.map +1 -0
  69. package/dist/components/setup/agent-setup.js +65 -0
  70. package/dist/components/setup/agent-setup.js.map +1 -0
  71. package/dist/components/setup/agents/agent-registry.d.ts +44 -0
  72. package/dist/components/setup/agents/agent-registry.d.ts.map +1 -0
  73. package/dist/components/setup/agents/agent-registry.js +64 -0
  74. package/dist/components/setup/agents/agent-registry.js.map +1 -0
  75. package/dist/components/setup/agents/command-helpers.d.ts +5 -0
  76. package/dist/components/setup/agents/command-helpers.d.ts.map +1 -0
  77. package/dist/components/setup/agents/command-helpers.js +28 -0
  78. package/dist/components/setup/agents/command-helpers.js.map +1 -0
  79. package/dist/components/setup/checking-agents.d.ts +16 -0
  80. package/dist/components/setup/checking-agents.d.ts.map +1 -0
  81. package/dist/components/setup/checking-agents.js +30 -0
  82. package/dist/components/setup/checking-agents.js.map +1 -0
  83. package/dist/components/setup/download-skills-and-plugins.d.ts +9 -0
  84. package/dist/components/setup/download-skills-and-plugins.d.ts.map +1 -0
  85. package/dist/components/setup/download-skills-and-plugins.js +29 -0
  86. package/dist/components/setup/download-skills-and-plugins.js.map +1 -0
  87. package/dist/components/setup/perform-setup.d.ts +23 -0
  88. package/dist/components/setup/perform-setup.d.ts.map +1 -0
  89. package/dist/components/setup/perform-setup.js +45 -0
  90. package/dist/components/setup/perform-setup.js.map +1 -0
  91. package/dist/components/spinner.d.ts +6 -2
  92. package/dist/components/spinner.d.ts.map +1 -1
  93. package/dist/components/spinner.js +12 -3
  94. package/dist/components/spinner.js.map +1 -1
  95. package/dist/hooks/use-credentials.d.ts +13 -0
  96. package/dist/hooks/use-credentials.d.ts.map +1 -0
  97. package/dist/hooks/use-credentials.js +33 -0
  98. package/dist/hooks/use-credentials.js.map +1 -0
  99. package/dist/lib/graphql.d.ts +57 -41
  100. package/dist/lib/graphql.d.ts.map +1 -1
  101. package/dist/lib/graphql.js +7 -0
  102. package/dist/lib/graphql.js.map +1 -1
  103. package/dist/lib/logger.d.ts +13 -8
  104. package/dist/lib/logger.d.ts.map +1 -1
  105. package/dist/lib/logger.js +6 -29
  106. package/dist/lib/logger.js.map +1 -1
  107. package/dist/lib/login.d.ts.map +1 -1
  108. package/dist/lib/middleware.d.ts +4 -8
  109. package/dist/lib/middleware.d.ts.map +1 -1
  110. package/dist/lib/middleware.js +5 -9
  111. package/dist/lib/middleware.js.map +1 -1
  112. package/dist/lib/skills-manager.d.ts +33 -0
  113. package/dist/lib/skills-manager.d.ts.map +1 -0
  114. package/dist/lib/skills-manager.js +233 -0
  115. package/dist/lib/skills-manager.js.map +1 -0
  116. package/dist/lib/skills-manager.test.d.ts +7 -0
  117. package/dist/lib/skills-manager.test.d.ts.map +1 -0
  118. package/dist/lib/skills-manager.test.js +248 -0
  119. package/dist/lib/skills-manager.test.js.map +1 -0
  120. package/dist/state/global-config.d.ts +23 -9
  121. package/dist/state/global-config.d.ts.map +1 -1
  122. package/dist/state/global-config.js +42 -36
  123. package/dist/state/global-config.js.map +1 -1
  124. package/dist/state/session-manager.js +2 -2
  125. package/dist/state/session-manager.js.map +1 -1
  126. package/dist/test/integration-helpers.d.ts +0 -5
  127. package/dist/test/integration-helpers.d.ts.map +1 -1
  128. package/dist/test/integration-helpers.js +0 -16
  129. package/dist/test/integration-helpers.js.map +1 -1
  130. package/package.json +15 -4
  131. package/dist/lib/output.d.ts +0 -16
  132. package/dist/lib/output.d.ts.map +0 -1
  133. package/dist/lib/output.js +0 -14
  134. package/dist/lib/output.js.map +0 -1
  135. package/dist/state/directory-config.d.ts +0 -21
  136. package/dist/state/directory-config.d.ts.map +0 -1
  137. package/dist/state/directory-config.js +0 -59
  138. package/dist/state/directory-config.js.map +0 -1
  139. /package/{LICENSE.txt → LICENSE} +0 -0
@@ -0,0 +1,64 @@
1
+ import { existsSync } from 'node:fs';
2
+ import { homedir } from 'node:os';
3
+ import { join } from 'node:path';
4
+ import { createLogger } from '../../../lib/logger.js';
5
+ import { getCommandOutput, runCommand } from './command-helpers.js';
6
+ const logger = createLogger();
7
+ const home = homedir();
8
+ export const MARKETPLACE_NAME = 'straion-claude-marketplace';
9
+ export const PLUGIN_NAME = 'straion';
10
+ function createRegistry(registry) {
11
+ return registry;
12
+ }
13
+ const claudeHome = process.env.CLAUDE_CONFIG_DIR?.trim() || join(home, '.claude');
14
+ export const agents = createRegistry({
15
+ 'claude-code': {
16
+ id: 'claude-code',
17
+ displayName: 'Claude Code',
18
+ globalSkillsDir: join(claudeHome, 'skills'),
19
+ checkAgentInstalled: () => runCommand('claude', ['--version']),
20
+ installPlugin: async (marketplacePath) => {
21
+ logger.info(`Installing plugin via Claude CLI from marketplace at ${marketplacePath}`);
22
+ const marketplaceList = await getCommandOutput('claude', ['plugin', 'marketplace', 'list']);
23
+ const marketplaceExists = marketplaceList?.includes(MARKETPLACE_NAME) ?? false;
24
+ if (!marketplaceExists) {
25
+ const addResult = await runCommand('claude', [
26
+ 'plugin',
27
+ 'marketplace',
28
+ 'add',
29
+ marketplacePath,
30
+ ]);
31
+ logger.info(addResult, `Marketplace ${marketplacePath} ${addResult ? 'added' : 'failed to add'}.`);
32
+ if (!addResult) {
33
+ return false;
34
+ }
35
+ }
36
+ else {
37
+ logger.info(`Marketplace ${MARKETPLACE_NAME} already exists, skipping add.`);
38
+ }
39
+ // Install the plugin from the marketplace
40
+ const pluginRef = `${PLUGIN_NAME}@${MARKETPLACE_NAME}`;
41
+ return runCommand('claude', ['plugin', 'install', pluginRef, '--scope', 'user']);
42
+ },
43
+ },
44
+ 'github-copilot': {
45
+ id: 'github-copilot',
46
+ displayName: 'GitHub Copilot',
47
+ globalSkillsDir: join(home, '.copilot/skills'),
48
+ checkAgentInstalled: async () => {
49
+ const output = await getCommandOutput('copilot', ['--version']);
50
+ // either "Install GitHub Copilot CLI? ['y/N']" or GitHub Copilot CLI vX.Y.Z
51
+ // one is returned when the CLI is not installed, but VSCode has the extension, so we can check for either string
52
+ return output?.includes('GitHub Copilot CLI') ?? false;
53
+ },
54
+ },
55
+ cursor: {
56
+ id: 'cursor',
57
+ displayName: 'Cursor',
58
+ globalSkillsDir: join(home, '.cursor/skills'),
59
+ checkAgentInstalled: async () => {
60
+ return existsSync(join(home, '.cursor'));
61
+ },
62
+ },
63
+ });
64
+ //# sourceMappingURL=agent-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-registry.js","sourceRoot":"","sources":["../../../../src/components/setup/agents/agent-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MA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*/
2
+ export declare function runCommand(cmd: string, args: string[]): Promise<boolean>;
3
+ /** Returns stdout if command succeeds, null otherwise */
4
+ export declare function getCommandOutput(cmd: string, args: string[]): Promise<string | null>;
5
+ //# sourceMappingURL=command-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-helpers.d.ts","sourceRoot":"","sources":["../../../../src/components/setup/agents/command-helpers.ts"],"names":[],"mappings":"AAEA,2DAA2D;AAC3D,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CASxE;AAED,yDAAyD;AACzD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAapF"}
@@ -0,0 +1,28 @@
1
+ import { spawn } from 'node:child_process';
2
+ /** Returns true if the command exits with status code 0 */
3
+ export function runCommand(cmd, args) {
4
+ return new Promise((resolve) => {
5
+ const child = spawn(cmd, args, {
6
+ stdio: ['ignore', 'ignore', 'ignore'],
7
+ timeout: 5000,
8
+ });
9
+ child.on('error', () => resolve(false));
10
+ child.on('close', (code) => resolve(code === 0));
11
+ });
12
+ }
13
+ /** Returns stdout if command succeeds, null otherwise */
14
+ export function getCommandOutput(cmd, args) {
15
+ return new Promise((resolve) => {
16
+ const child = spawn(cmd, args, {
17
+ stdio: ['ignore', 'pipe', 'ignore'],
18
+ timeout: 5000,
19
+ });
20
+ let output = '';
21
+ child.stdout?.on('data', (data) => {
22
+ output += data.toString();
23
+ });
24
+ child.on('error', () => resolve(null));
25
+ child.on('close', (code) => resolve(code === 0 ? output : null));
26
+ });
27
+ }
28
+ //# sourceMappingURL=command-helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-helpers.js","sourceRoot":"","sources":["../../../../src/components/setup/agents/command-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,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,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { Logger } from 'pino';
2
+ import React from 'react';
3
+ import { type AgentId } from './agents/agent-registry.js';
4
+ interface CheckingAgentsProps {
5
+ logger: Logger;
6
+ onComplete: (status: AgentsCheckStatus) => void;
7
+ }
8
+ export type AgentsCheckStatus = Record<AgentId, AgentCheckResult>;
9
+ export type AgentCheckResult = {
10
+ id: AgentId;
11
+ installed: boolean;
12
+ status: 'error' | 'success';
13
+ };
14
+ export declare function CheckingAgents({ logger, onComplete }: CheckingAgentsProps): React.JSX.Element;
15
+ export {};
16
+ //# sourceMappingURL=checking-agents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checking-agents.d.ts","sourceRoot":"","sources":["../../../src/components/setup/checking-agents.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACnC,OAAO,KAA8B,MAAM,OAAO,CAAC;AAInD,OAAO,EAAU,KAAK,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAElE,UAAU,mBAAmB;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,IAAI,CAAC;CACjD;AAED,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;AAElE,MAAM,MAAM,gBAAgB,GAAG;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,OAAO,GAAG,SAAS,CAAA;CAAE,CAAC;AAEhG,wBAAgB,cAAc,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,mBAAmB,qBAoCzE"}
@@ -0,0 +1,30 @@
1
+ import { Text } from 'ink';
2
+ import React, { useEffect, useState } from 'react';
3
+ import { Spinner } from '../spinner.js';
4
+ import { agents } from './agents/agent-registry.js';
5
+ export function CheckingAgents({ logger, onComplete }) {
6
+ const [isChecking, setIsChecking] = useState(true);
7
+ useEffect(() => {
8
+ async function checkAll() {
9
+ const result = {};
10
+ await Promise.allSettled(Object.values(agents).map(async (agent) => {
11
+ result[agent.id] = { id: agent.id, installed: false, status: 'error' };
12
+ logger.info(`Checking installation for agent: ${agent.displayName}`);
13
+ const installed = await agent.checkAgentInstalled();
14
+ logger.info(`Agent ${agent.displayName} is ${installed ? 'installed' : 'not installed'}.`);
15
+ result[agent.id] = { id: agent.id, installed, status: 'success' };
16
+ return installed;
17
+ }));
18
+ for (const [agentId, agentResult] of Object.entries(result)) {
19
+ if (agentResult.status === 'error') {
20
+ logger.error(`Error checking agent installation: ${agentId}`);
21
+ }
22
+ }
23
+ setIsChecking(false);
24
+ onComplete(result);
25
+ }
26
+ checkAll();
27
+ }, []);
28
+ return isChecking ? (React.createElement(Spinner, null, "Checking agents...")) : (React.createElement(Text, { color: "green" }, "\u25C9 Checking agents done"));
29
+ }
30
+ //# sourceMappingURL=checking-agents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checking-agents.js","sourceRoot":"","sources":["../../../src/components/setup/checking-agents.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAE3B,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,MAAM,EAAgB,MAAM,4BAA4B,CAAC;AAWlE,MAAM,UAAU,cAAc,CAAC,EAAE,MAAM,EAAE,UAAU,EAAuB;IACxE,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAEnD,SAAS,CAAC,GAAG,EAAE;QACb,KAAK,UAAU,QAAQ;YACrB,MAAM,MAAM,GA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,IAAI,IAAC,KAAK,EAAC,OAAO,kCAA8B,CAClD,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { Logger } from 'pino';
2
+ import React from 'react';
3
+ interface DownloadSkillsAndPluginsProps {
4
+ logger: Logger;
5
+ onComplete: (success: boolean) => void;
6
+ }
7
+ export declare function DownloadSkillsAndPlugins({ logger, onComplete }: DownloadSkillsAndPluginsProps): React.JSX.Element;
8
+ export {};
9
+ //# sourceMappingURL=download-skills-and-plugins.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"download-skills-and-plugins.d.ts","sourceRoot":"","sources":["../../../src/components/setup/download-skills-and-plugins.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACnC,OAAO,KAA8B,MAAM,OAAO,CAAC;AAKnD,UAAU,6BAA6B;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CACxC;AAED,wBAAgB,wBAAwB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,6BAA6B,qBAkC7F"}
@@ -0,0 +1,29 @@
1
+ import { Text } from 'ink';
2
+ import React, { useEffect, useState } from 'react';
3
+ import { download } from '../../lib/skills-manager.js';
4
+ import { Spinner } from '../spinner.js';
5
+ export function DownloadSkillsAndPlugins({ logger, onComplete }) {
6
+ const [isChecking, setIsChecking] = useState(true);
7
+ const [hasError, setHasError] = useState(false);
8
+ const [progressMessage, setProgressMessage] = useState('');
9
+ useEffect(() => {
10
+ async function runDownload() {
11
+ try {
12
+ await download((msg) => setProgressMessage(msg));
13
+ setIsChecking(false);
14
+ onComplete(true);
15
+ }
16
+ catch (error) {
17
+ setIsChecking(false);
18
+ setHasError(true);
19
+ onComplete(false);
20
+ logger.error({
21
+ error: error instanceof Error ? error.message : String(error),
22
+ }, 'Error downloading skills and plugins.');
23
+ }
24
+ }
25
+ runDownload();
26
+ }, []);
27
+ return isChecking ? (React.createElement(Spinner, null, progressMessage)) : hasError ? (React.createElement(Text, { color: "red" }, "\u25EF Downloading skills and plugins failed")) : (React.createElement(Text, { color: "green" }, "\u25C9 Downloading skills and plugins done"));
28
+ }
29
+ //# sourceMappingURL=download-skills-and-plugins.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"download-skills-and-plugins.js","sourceRoot":"","sources":["../../../src/components/setup/download-skills-and-plugins.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAE3B,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAOxC,MAAM,UAAU,wBAAwB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAiC;IAC5F,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IACnD,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChD,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IAE3D,SAAS,CAAC,GAAG,EAAE;QACb,KAAK,UAAU,WAAW;YACxB,IAAI,CAAC;gBACH,MAAM,QAAQ,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC;gBACjD,aAAa,CAAC,KAAK,CAAC,CAAC;gBACrB,UAAU,CAAC,IAAI,CAAC,CAAC;YACnB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,aAAa,CAAC,KAAK,CAAC,CAAC;gBACrB,WAAW,CAAC,IAAI,CAAC,CAAC;gBAClB,UAAU,CAAC,KAAK,CAAC,CAAC;gBAClB,MAAM,CAAC,KAAK,CACV;oBACE,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;iBAC9D,EACD,uCAAuC,CACxC,CAAC;YACJ,CAAC;QACH,CAAC;QAED,WAAW,EAAE,CAAC;IAChB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,UAAU,CAAC,CAAC,CAAC,CAClB,oBAAC,OAAO,QAAE,eAAe,CAAW,CACrC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CACb,oBAAC,IAAI,IAAC,KAAK,EAAC,KAAK,mDAA+C,CACjE,CAAC,CAAC,CAAC,CACF,oBAAC,IAAI,IAAC,KAAK,EAAC,OAAO,iDAA6C,CACjE,CAAC;AACJ,CAAC"}
@@ -0,0 +1,23 @@
1
+ import type { Logger } from 'pino';
2
+ import React from 'react';
3
+ import { type AgentId } from './agents/agent-registry.js';
4
+ type PerformSetupProps = {
5
+ selectedAgentIds: AgentId[];
6
+ logger: Logger;
7
+ onComplete: (status: AgentsSetupStatus) => void;
8
+ };
9
+ export type AgentsSetupStatus = Record<AgentId, AgentSetupResult>;
10
+ export type AgentSetupResult = {
11
+ id: AgentId;
12
+ type: 'plugin' | 'skill' | 'none';
13
+ mode: 'plugin' | 'symlink' | 'copy' | 'none';
14
+ status: 'success';
15
+ } | {
16
+ id: AgentId;
17
+ type?: never;
18
+ mode?: never;
19
+ status: 'error';
20
+ };
21
+ export declare const PerformSetup: (props: PerformSetupProps) => React.JSX.Element;
22
+ export {};
23
+ //# sourceMappingURL=perform-setup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"perform-setup.d.ts","sourceRoot":"","sources":["../../../src/components/setup/perform-setup.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACnC,OAAO,KAA8B,MAAM,OAAO,CAAC;AAKnD,OAAO,EAAU,KAAK,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAElE,KAAK,iBAAiB,GAAG;IACvB,gBAAgB,EAAE,OAAO,EAAE,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,IAAI,CAAC;CACjD,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;AAElE,MAAM,MAAM,gBAAgB,GACxB;IACE,EAAE,EAAE,OAAO,CAAC;IACZ,IAAI,EAAE,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;IAClC,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;IAC7C,MAAM,EAAE,SAAS,CAAC;CACnB,GACD;IACE,EAAE,EAAE,OAAO,CAAC;IACZ,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEN,eAAO,MAAM,YAAY,GAAI,OAAO,iBAAiB,sBAkDpD,CAAC"}
@@ -0,0 +1,45 @@
1
+ import { Text } from 'ink';
2
+ import React, { useEffect, useState } from 'react';
3
+ import { link } from '../../lib/skills-manager.js';
4
+ import { Spinner } from '../spinner.js';
5
+ import { agents } from './agents/agent-registry.js';
6
+ export const PerformSetup = (props) => {
7
+ const { selectedAgentIds, logger, onComplete } = props;
8
+ const [isSettingUp, setIsSettingUp] = useState(true);
9
+ const [hasError, setHasError] = useState(false);
10
+ useEffect(() => {
11
+ const result = {};
12
+ async function setup() {
13
+ await Promise.allSettled(selectedAgentIds.map(async (agentId) => {
14
+ result[agentId] = { id: agentId, status: 'error' };
15
+ logger.info(`Performing setup for agent: ${agentId}`);
16
+ const linkResults = await link(agentId);
17
+ const allSuccessful = linkResults.every((res) => res.success);
18
+ const mode = linkResults[0]?.mode ?? 'none';
19
+ const type = linkResults[0]?.type ?? 'none';
20
+ result[agentId] = {
21
+ id: agentId,
22
+ status: 'success',
23
+ mode: mode,
24
+ type: type,
25
+ };
26
+ return allSuccessful;
27
+ }));
28
+ for (const [agentId, agentResult] of Object.entries(result)) {
29
+ if (agentResult.status === 'error') {
30
+ logger.error(`Error setting up agent: ${agentId}`);
31
+ setHasError(true);
32
+ }
33
+ }
34
+ setIsSettingUp(false);
35
+ onComplete(result);
36
+ }
37
+ setup();
38
+ return;
39
+ }, [selectedAgentIds]);
40
+ return isSettingUp ? (React.createElement(Spinner, null, "Setting up agents...")) : hasError ? (React.createElement(Text, { color: "red" }, "\u25EF Setting up agents failed")) : (React.createElement(Text, { color: "green" },
41
+ "\u25C9 Setting up agents (",
42
+ selectedAgentIds.map((id) => agents[id].displayName).join(', '),
43
+ ") done"));
44
+ };
45
+ //# sourceMappingURL=perform-setup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"perform-setup.js","sourceRoot":"","sources":["../../../src/components/setup/perform-setup.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAE3B,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,MAAM,EAAgB,MAAM,4BAA4B,CAAC;AAwBlE,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAwB,EAAE,EAAE;IACvD,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC;IACvD,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IACrD,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAEhD,SAAS,CAAC,G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,KAAK,EAAE,CAAC;QACR,OAAO;IACT,CAAC,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAEvB,OAAO,WAAW,CAAC,CAAC,CAAC,CACnB,oBAAC,OAAO,+BAA+B,CACxC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CACb,oBAAC,IAAI,IAAC,KAAK,EAAC,KAAK,sCAAkC,CACpD,CAAC,CAAC,CAAC,CACF,oBAAC,IAAI,IAAC,KAAK,EAAC,OAAO;;QACK,gBAAgB,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;iBAChF,CACR,CAAC;AACJ,CAAC,CAAC"}
@@ -1,3 +1,7 @@
1
- import React from 'react';
2
- export declare function Spinner(): React.JSX.Element;
1
+ import React, { type ReactNode } from 'react';
2
+ type SpinnerProps = {
3
+ children?: ReactNode;
4
+ };
5
+ export declare function Spinner({ children }: SpinnerProps): React.JSX.Element;
6
+ export {};
3
7
  //# sourceMappingURL=spinner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../src/components/spinner.tsx"],"names":[],"mappings":"AACA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAEnD,wBAAgB,OAAO,sBAkBtB"}
1
+ {"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../src/components/spinner.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAuB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEnE,KAAK,YAAY,GAAG;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AA0BF,wBAAgB,OAAO,CAAC,EAAE,QAAQ,EAAE,EAAE,YAAY,qBAUjD"}
@@ -1,6 +1,6 @@
1
- import { Text } from 'ink';
1
+ import { Box, Text } from 'ink';
2
2
  import React, { useEffect, useState } from 'react';
3
- export function Spinner() {
3
+ function SpinnerInner() {
4
4
  const [frame, setFrame] = useState(0);
5
5
  const spinner = { frames: ['·', '✻', '✽', '✶', '✳', '✢'], interval: 80 };
6
6
  useEffect(() => {
@@ -14,6 +14,15 @@ export function Spinner() {
14
14
  clearInterval(timer);
15
15
  };
16
16
  }, [spinner]);
17
- return React.createElement(Text, { color: frame % 2 === 0 ? 'magenta' : 'magentaBright' }, spinner.frames[frame]);
17
+ return (React.createElement(Box, { width: 2, justifyContent: "center" },
18
+ React.createElement(Text, { color: frame % 2 === 0 ? 'magenta' : 'magentaBright' }, spinner.frames[frame])));
19
+ }
20
+ export function Spinner({ children }) {
21
+ if (children) {
22
+ return (React.createElement(Box, { gap: 1 },
23
+ React.createElement(SpinnerInner, null),
24
+ typeof children === 'string' ? React.createElement(Text, null, children) : children));
25
+ }
26
+ return React.createElement(SpinnerInner, null);
18
27
  }
19
28
  //# sourceMappingURL=spinner.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"spinner.js","sourceRoot":"","sources":["../../src/components/spinner.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEnD,MAAM,UAAU,OAAO;IACrB,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACtC,MAAM,OAAO,GAAG,EAAE,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IAEzE,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE;YAC7B,QAAQ,CAAC,CAAC,aAAa,EAAE,EAAE;gBACzB,MAAM,WAAW,GAAG,aAAa,KAAK,OAAO,CAAC,MAAM,CAAC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,aAAa,GAAG,CAAC,CAAC;YAC7C,CAAC,CAAC,CAAC;QACL,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;QAErB,OAAO,GAAG,EAAE;YACV,aAAa,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,OAAO,CACL,oBAAC,GAAG,IAAC,KAAK,EAAE,CAAC,EAAE,cAAc,EAAC,QAAQ;QACpC,oBAAC,IAAI,IAAC,KAAK,EAAE,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,eAAe,IAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAQ,CACtF,CACP,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,EAAE,QAAQ,EAAgB;IAChD,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,CACL,oBAAC,GAAG,IAAC,GAAG,EAAE,CAAC;YACT,oBAAC,YAAY,OAAG;YACf,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,oBAAC,IAAI,QAAE,QAAQ,CAAQ,CAAC,CAAC,CAAC,QAAQ,CAC9D,CACP,CAAC;IACJ,CAAC;IACD,OAAO,oBAAC,YAAY,OAAG,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { Logger } from 'pino';
2
+ import type { StoredCredentials } from '../auth/credentials.js';
3
+ import type { OrganizationFragment } from '../lib/graphql.js';
4
+ export declare function useHasValidCredentials({ enabled, credentials, logger, }: {
5
+ enabled?: boolean;
6
+ credentials: StoredCredentials | null;
7
+ logger?: Logger;
8
+ }): {
9
+ hasValidCredentials: boolean;
10
+ organizations: OrganizationFragment[] | null;
11
+ isFinished: boolean;
12
+ };
13
+ //# sourceMappingURL=use-credentials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-credentials.d.ts","sourceRoot":"","sources":["../../src/hooks/use-credentials.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAGnC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAI9D,wBAAgB,sBAAsB,CAAC,EACrC,OAAc,EACd,WAAW,EACX,MAAM,GACP,EAAE;IACD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;;;;EAoCA"}
@@ -0,0 +1,33 @@
1
+ import { useEffect, useState } from 'react';
2
+ import { loginUser } from '../lib/login.js';
3
+ import { resolveOrgForDirectory } from '../state/global-config.js';
4
+ export function useHasValidCredentials({ enabled = true, credentials, logger, }) {
5
+ const [hasValidCredentials, setHasValidCredentials] = useState(false);
6
+ const [isFinished, setIsFinished] = useState(false);
7
+ const [organizations, setOrganizations] = useState(null);
8
+ // Validate existing credentials and resolve org
9
+ useEffect(() => {
10
+ if (!enabled || !credentials) {
11
+ setIsFinished(true);
12
+ return;
13
+ }
14
+ async function validateCredentials() {
15
+ const resolvedOrg = resolveOrgForDirectory(process.cwd());
16
+ try {
17
+ const result = await loginUser(credentials.accessToken);
18
+ const stillHasAccessToOrg = resolvedOrg !== null &&
19
+ result.me.organizations.nodes.some((org) => org.id === resolvedOrg.id);
20
+ setHasValidCredentials(stillHasAccessToOrg);
21
+ setOrganizations(result.me.organizations.nodes);
22
+ }
23
+ catch (error) {
24
+ logger?.error({ error: error instanceof Error ? error.message : String(error) }, 'Error during login or organization resolution');
25
+ setHasValidCredentials(false);
26
+ }
27
+ setIsFinished(true);
28
+ }
29
+ validateCredentials();
30
+ }, [credentials, logger, enabled]);
31
+ return { hasValidCredentials, organizations, isFinished };
32
+ }
33
+ //# sourceMappingURL=use-credentials.js.map
@@ -0,0 +1 @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,CAAC,CAAC;YAClD,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,EAAE,KAAK,CACX,EAAE,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EACjE,+CAA+C,CAChD,CAAC;gBACF,sBAAsB,CAAC,KAAK,CAAC,CAAC;YAChC,CAAC;YACD,aAAa,CAAC,IAAI,CAAC,CAAC;QACtB,CAAC;QAED,mBAAmB,EAAE,CAAC;IACxB,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAEnC,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC;AAC5D,CAAC"}
@@ -563,13 +563,6 @@ export type DocumentUpdate = {
563
563
  organization: Organization;
564
564
  updatedAt: Scalars['DateTime']['output'];
565
565
  };
566
- export type DocumentUpdateEdge = {
567
- __typename?: 'DocumentUpdateEdge';
568
- /** Base64 encoded cursor representing the position of this node in the dataset. */
569
- cursor: Scalars['String']['output'];
570
- /** The actual data node */
571
- node: DocumentUpdate;
572
- };
573
566
  export type DocumentValidationResult = {
574
567
  __typename?: 'DocumentValidationResult';
575
568
  action?: Maybe<Scalars['String']['output']>;
@@ -601,6 +594,23 @@ export declare enum DocumentValidationResultStatus {
601
594
  NotMet = "not_met",
602
595
  Pending = "pending"
603
596
  }
597
+ export type ExtractedRequirement = {
598
+ __typename?: 'ExtractedRequirement';
599
+ collectionId: Scalars['String']['output'];
600
+ id: Scalars['String']['output'];
601
+ mandatory: Scalars['Boolean']['output'];
602
+ text: Scalars['String']['output'];
603
+ };
604
+ export type ExtractionSession = {
605
+ __typename?: 'ExtractionSession';
606
+ sessionId: Scalars['String']['output'];
607
+ };
608
+ /** The source type for requirements extraction */
609
+ export declare enum ExtractionSourceType {
610
+ Content = "CONTENT",
611
+ Repository = "REPOSITORY",
612
+ Website = "WEBSITE"
613
+ }
604
614
  export type GetPullRequestValidationResultsInput = {
605
615
  /** Optional: Filter by specific commit SHA */
606
616
  headSha?: InputMaybe<Scalars['String']['input']>;
@@ -702,7 +712,6 @@ export type Mutation = {
702
712
  deleteUserFilter: Scalars['Boolean']['output'];
703
713
  dismissAnnouncement: Scalars['Boolean']['output'];
704
714
  endCollaborationSession: Scalars['Boolean']['output'];
705
- extractRequirements: RequirementCollection;
706
715
  forgotPassword: Scalars['Boolean']['output'];
707
716
  getGithubToken: GithubToken;
708
717
  inviteUserToOrganization: OrganizationInvite;
@@ -736,6 +745,8 @@ export type Mutation = {
736
745
  /** Start a new build for a repository and returns the build id */
737
746
  startBuild: Build;
738
747
  startCollaborationSession: Scalars['Boolean']['output'];
748
+ /** Start a requirements extraction process and return a session ID for subscription */
749
+ startRequirementExtraction: ExtractionSession;
739
750
  storeGithubInstallation: GithubInstallation;
740
751
  /** Switches the organization of the user and creates a new pair of accessToken and refreshToken */
741
752
  switchOrganization: Token;
@@ -886,9 +897,6 @@ export type MutationDismissAnnouncementArgs = {
886
897
  export type MutationEndCollaborationSessionArgs = {
887
898
  documentId: Scalars['String']['input'];
888
899
  };
889
- export type MutationExtractRequirementsArgs = {
890
- body: Scalars['String']['input'];
891
- };
892
900
  export type MutationForgotPasswordArgs = {
893
901
  email: Scalars['String']['input'];
894
902
  };
@@ -983,6 +991,9 @@ export type MutationStartCollaborationSessionArgs = {
983
991
  discussionId?: InputMaybe<Scalars['String']['input']>;
984
992
  documentId: Scalars['String']['input'];
985
993
  };
994
+ export type MutationStartRequirementExtractionArgs = {
995
+ input: StartExtractionInput;
996
+ };
986
997
  export type MutationStoreGithubInstallationArgs = {
987
998
  installationId: Scalars['Float']['input'];
988
999
  };
@@ -1215,17 +1226,6 @@ export type PaginatedDocument = {
1215
1226
  /** The total number of items across all pages. */
1216
1227
  totalCount: Scalars['Float']['output'];
1217
1228
  };
1218
- export type PaginatedDocumentUpdate = {
1219
- __typename?: 'PaginatedDocumentUpdate';
1220
- /** Edges of the current page, containing nodes and their cursors. */
1221
- edges?: Maybe<Array<DocumentUpdateEdge>>;
1222
- /** The actual data node */
1223
- nodes: Array<DocumentUpdate>;
1224
- /** Information about the current page state and available navigation. */
1225
- pageInfo?: Maybe<PageInfo>;
1226
- /** The total number of items across all pages. */
1227
- totalCount: Scalars['Float']['output'];
1228
- };
1229
1229
  export type PaginatedOrganization = {
1230
1230
  __typename?: 'PaginatedOrganization';
1231
1231
  /** Edges of the current page, containing nodes and their cursors. */
@@ -1336,6 +1336,8 @@ export type Query = {
1336
1336
  _allOrganizations: PaginatedOrganization;
1337
1337
  _organizationExists: Scalars['Boolean']['output'];
1338
1338
  _statistics: Statistics;
1339
+ /** Get active extraction sessions for the current user */
1340
+ activeExtractionSessions: Array<RequirementExtractionProgress>;
1339
1341
  availableGithubRepos: Array<GithubRepo>;
1340
1342
  build: Build;
1341
1343
  builds: Array<Build>;
@@ -1346,11 +1348,8 @@ export type Query = {
1346
1348
  defaultBranch?: Maybe<GithubBranch>;
1347
1349
  discussion: DocumentDiscussion;
1348
1350
  document: Document;
1349
- documentDiffVersion: Scalars['String']['output'];
1350
1351
  documentFilters: Array<UserFilter>;
1351
1352
  documentValidationResults: Array<DocumentValidationResult>;
1352
- /** Retrieves a list of document versions by the document's id. */
1353
- documentVersions: PaginatedDocumentUpdate;
1354
1353
  documents: PaginatedDocument;
1355
1354
  findAllOrganizationAccessTokens: Array<AccessToken>;
1356
1355
  findAllUserAccessTokens: Array<UserAccessToken>;
@@ -1452,25 +1451,9 @@ export type QueryDocumentArgs = {
1452
1451
  externalId?: InputMaybe<Scalars['String']['input']>;
1453
1452
  id?: InputMaybe<Scalars['String']['input']>;
1454
1453
  };
1455
- export type QueryDocumentDiffVersionArgs = {
1456
- count?: InputMaybe<Scalars['Int']['input']>;
1457
- externalId?: InputMaybe<Scalars['String']['input']>;
1458
- from?: InputMaybe<Scalars['String']['input']>;
1459
- id?: InputMaybe<Scalars['String']['input']>;
1460
- to: Scalars['String']['input'];
1461
- };
1462
1454
  export type QueryDocumentValidationResultsArgs = {
1463
1455
  documentId: Scalars['String']['input'];
1464
1456
  };
1465
- export type QueryDocumentVersionsArgs = {
1466
- after?: InputMaybe<Scalars['String']['input']>;
1467
- before?: InputMaybe<Scalars['String']['input']>;
1468
- documentId: Scalars['String']['input'];
1469
- first?: InputMaybe<Scalars['Int']['input']>;
1470
- last?: InputMaybe<Scalars['Int']['input']>;
1471
- sort?: InputMaybe<SortDirection>;
1472
- sortBy?: InputMaybe<Scalars['String']['input']>;
1473
- };
1474
1457
  export type QueryDocumentsArgs = {
1475
1458
  after?: InputMaybe<Scalars['String']['input']>;
1476
1459
  before?: InputMaybe<Scalars['String']['input']>;
@@ -1650,6 +1633,26 @@ export type RequirementCollectionEdge = {
1650
1633
  /** The actual data node */
1651
1634
  node: RequirementCollection;
1652
1635
  };
1636
+ export type RequirementCollectionPreview = {
1637
+ __typename?: 'RequirementCollectionPreview';
1638
+ description: Scalars['String']['output'];
1639
+ name: Scalars['String']['output'];
1640
+ requirementCount: Scalars['Int']['output'];
1641
+ requirements: Array<ExtractedRequirement>;
1642
+ };
1643
+ export type RequirementExtractionProgress = {
1644
+ __typename?: 'RequirementExtractionProgress';
1645
+ collections?: Maybe<Array<RequirementCollectionPreview>>;
1646
+ currentStep: Scalars['Int']['output'];
1647
+ domainName?: Maybe<Scalars['String']['output']>;
1648
+ errorMessage?: Maybe<Scalars['String']['output']>;
1649
+ estimatedSecondsRemaining?: Maybe<Scalars['Int']['output']>;
1650
+ message: Scalars['String']['output'];
1651
+ phase: Scalars['String']['output'];
1652
+ progressPercent: Scalars['Int']['output'];
1653
+ sessionId: Scalars['String']['output'];
1654
+ totalSteps: Scalars['Int']['output'];
1655
+ };
1653
1656
  export type RequirementMatch = {
1654
1657
  __typename?: 'RequirementMatch';
1655
1658
  collectionId: Scalars['String']['output'];
@@ -1785,6 +1788,14 @@ export declare enum SortDirection {
1785
1788
  Asc = "ASC",
1786
1789
  Desc = "DESC"
1787
1790
  }
1791
+ export type StartExtractionInput = {
1792
+ branch?: InputMaybe<Scalars['String']['input']>;
1793
+ content?: InputMaybe<Scalars['String']['input']>;
1794
+ githubToken?: InputMaybe<Scalars['String']['input']>;
1795
+ repoUrl?: InputMaybe<Scalars['String']['input']>;
1796
+ sourceType: ExtractionSourceType;
1797
+ url?: InputMaybe<Scalars['String']['input']>;
1798
+ };
1788
1799
  export type Statistics = {
1789
1800
  __typename?: 'Statistics';
1790
1801
  documents: Scalars['Int']['output'];
@@ -1794,6 +1805,8 @@ export type Statistics = {
1794
1805
  export type Subscription = {
1795
1806
  __typename?: 'Subscription';
1796
1807
  codeValidationProgress: CodeValidationResult;
1808
+ /** Subscribe to extraction progress updates for a session */
1809
+ extractionProgress: RequirementExtractionProgress;
1797
1810
  getBuildTraceLogs: BuildTraceLog;
1798
1811
  getBuildTraceSpans: BuildTraceSpan;
1799
1812
  getBuildUpdates: Build;
@@ -1806,6 +1819,9 @@ export type Subscription = {
1806
1819
  export type SubscriptionCodeValidationProgressArgs = {
1807
1820
  sessionId: Scalars['String']['input'];
1808
1821
  };
1822
+ export type SubscriptionExtractionProgressArgs = {
1823
+ sessionId: Scalars['String']['input'];
1824
+ };
1809
1825
  export type SubscriptionGetBuildTraceLogsArgs = {
1810
1826
  buildId: Scalars['String']['input'];
1811
1827
  };