@straion/cli 0.0.1 → 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.
- package/CHANGELOG.md +13 -0
- package/README.md +0 -4
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +2 -4
- package/dist/cli.js.map +1 -1
- package/dist/commands/default.d.ts.map +1 -1
- package/dist/commands/default.js +7 -30
- package/dist/commands/default.js.map +1 -1
- package/dist/commands/find-requirements.d.ts.map +1 -1
- package/dist/commands/find-requirements.integration.test.d.ts +5 -0
- package/dist/commands/find-requirements.integration.test.d.ts.map +1 -0
- package/dist/commands/find-requirements.integration.test.js +92 -0
- package/dist/commands/find-requirements.integration.test.js.map +1 -0
- package/dist/commands/find-requirements.js +26 -7
- package/dist/commands/find-requirements.js.map +1 -1
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +2 -0
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.integration.test.d.ts +13 -0
- package/dist/commands/login.integration.test.d.ts.map +1 -0
- package/dist/commands/login.integration.test.js +67 -0
- package/dist/commands/login.integration.test.js.map +1 -0
- package/dist/commands/login.js +20 -5
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/logout.d.ts.map +1 -1
- package/dist/commands/logout.js +9 -14
- package/dist/commands/logout.js.map +1 -1
- package/dist/commands/session-start.d.ts.map +1 -1
- package/dist/commands/session-start.js +1 -2
- package/dist/commands/session-start.js.map +1 -1
- package/dist/commands/setup.d.ts +3 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +23 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/components/banner.d.ts +3 -0
- package/dist/components/banner.d.ts.map +1 -0
- package/dist/components/banner.js +13 -0
- package/dist/components/banner.js.map +1 -0
- package/dist/components/button.d.ts +2 -2
- package/dist/components/button.d.ts.map +1 -1
- package/dist/components/button.js +3 -3
- package/dist/components/button.js.map +1 -1
- package/dist/components/default-flow.d.ts +11 -0
- package/dist/components/default-flow.d.ts.map +1 -0
- package/dist/components/default-flow.js +64 -0
- package/dist/components/default-flow.js.map +1 -0
- package/dist/components/hero.d.ts +2 -1
- package/dist/components/hero.d.ts.map +1 -1
- package/dist/components/hero.js +79 -19
- package/dist/components/hero.js.map +1 -1
- package/dist/components/link.d.ts +2 -2
- package/dist/components/link.d.ts.map +1 -1
- package/dist/components/link.js +3 -3
- package/dist/components/link.js.map +1 -1
- package/dist/components/login/login-error.d.ts +6 -0
- package/dist/components/login/login-error.d.ts.map +1 -0
- package/dist/components/login/login-error.js +14 -0
- package/dist/components/login/login-error.js.map +1 -0
- package/dist/components/login/login-flow.d.ts +8 -2
- package/dist/components/login/login-flow.d.ts.map +1 -1
- package/dist/components/login/login-flow.js +95 -84
- package/dist/components/login/login-flow.js.map +1 -1
- package/dist/components/login/login-flow.test.js +69 -7
- package/dist/components/login/login-flow.test.js.map +1 -1
- package/dist/components/login/types.d.ts +2 -0
- package/dist/components/login/types.d.ts.map +1 -0
- package/dist/components/login/types.js +2 -0
- package/dist/components/login/types.js.map +1 -0
- package/dist/components/login/user-settings-link.d.ts +3 -0
- package/dist/components/login/user-settings-link.d.ts.map +1 -0
- package/dist/components/login/user-settings-link.js +8 -0
- package/dist/components/login/user-settings-link.js.map +1 -0
- package/dist/components/multi-select.d.ts +16 -0
- package/dist/components/multi-select.d.ts.map +1 -0
- package/dist/components/multi-select.js +105 -0
- package/dist/components/multi-select.js.map +1 -0
- package/dist/components/org-selector.d.ts +2 -1
- package/dist/components/org-selector.d.ts.map +1 -1
- package/dist/components/org-selector.js +9 -2
- package/dist/components/org-selector.js.map +1 -1
- package/dist/components/pat-input.d.ts +2 -1
- package/dist/components/pat-input.d.ts.map +1 -1
- package/dist/components/pat-input.js +9 -3
- package/dist/components/pat-input.js.map +1 -1
- package/dist/components/pat-input.test.js +8 -8
- package/dist/components/pat-input.test.js.map +1 -1
- package/dist/components/setup/agent-setup.d.ts +9 -0
- package/dist/components/setup/agent-setup.d.ts.map +1 -0
- package/dist/components/setup/agent-setup.js +65 -0
- package/dist/components/setup/agent-setup.js.map +1 -0
- package/dist/components/setup/agents/agent-registry.d.ts +44 -0
- package/dist/components/setup/agents/agent-registry.d.ts.map +1 -0
- package/dist/components/setup/agents/agent-registry.js +64 -0
- package/dist/components/setup/agents/agent-registry.js.map +1 -0
- package/dist/components/setup/agents/command-helpers.d.ts +5 -0
- package/dist/components/setup/agents/command-helpers.d.ts.map +1 -0
- package/dist/components/setup/agents/command-helpers.js +28 -0
- package/dist/components/setup/agents/command-helpers.js.map +1 -0
- package/dist/components/setup/checking-agents.d.ts +16 -0
- package/dist/components/setup/checking-agents.d.ts.map +1 -0
- package/dist/components/setup/checking-agents.js +30 -0
- package/dist/components/setup/checking-agents.js.map +1 -0
- package/dist/components/setup/download-skills-and-plugins.d.ts +9 -0
- package/dist/components/setup/download-skills-and-plugins.d.ts.map +1 -0
- package/dist/components/setup/download-skills-and-plugins.js +29 -0
- package/dist/components/setup/download-skills-and-plugins.js.map +1 -0
- package/dist/components/setup/perform-setup.d.ts +23 -0
- package/dist/components/setup/perform-setup.d.ts.map +1 -0
- package/dist/components/setup/perform-setup.js +45 -0
- package/dist/components/setup/perform-setup.js.map +1 -0
- package/dist/components/spinner.d.ts +6 -1
- package/dist/components/spinner.d.ts.map +1 -1
- package/dist/components/spinner.js +13 -5
- package/dist/components/spinner.js.map +1 -1
- package/dist/components/tabs.d.ts +3 -3
- package/dist/components/tabs.d.ts.map +1 -1
- package/dist/components/tabs.js +26 -21
- package/dist/components/tabs.js.map +1 -1
- package/dist/hooks/use-credentials.d.ts +13 -0
- package/dist/hooks/use-credentials.d.ts.map +1 -0
- package/dist/hooks/use-credentials.js +33 -0
- package/dist/hooks/use-credentials.js.map +1 -0
- package/dist/lib/graphql.d.ts +57 -41
- package/dist/lib/graphql.d.ts.map +1 -1
- package/dist/lib/graphql.js +7 -0
- package/dist/lib/graphql.js.map +1 -1
- package/dist/lib/ink-render.d.ts +1 -1
- package/dist/lib/ink-render.js +1 -1
- package/dist/lib/logger.d.ts +13 -8
- package/dist/lib/logger.d.ts.map +1 -1
- package/dist/lib/logger.js +6 -29
- package/dist/lib/logger.js.map +1 -1
- package/dist/lib/login.d.ts.map +1 -1
- package/dist/lib/middleware.d.ts +2 -1
- package/dist/lib/middleware.d.ts.map +1 -1
- package/dist/lib/middleware.js +18 -6
- package/dist/lib/middleware.js.map +1 -1
- package/dist/lib/skills-manager.d.ts +33 -0
- package/dist/lib/skills-manager.d.ts.map +1 -0
- package/dist/lib/skills-manager.js +233 -0
- package/dist/lib/skills-manager.js.map +1 -0
- package/dist/lib/skills-manager.test.d.ts +7 -0
- package/dist/lib/skills-manager.test.d.ts.map +1 -0
- package/dist/lib/skills-manager.test.js +248 -0
- package/dist/lib/skills-manager.test.js.map +1 -0
- package/dist/state/global-config.d.ts +23 -9
- package/dist/state/global-config.d.ts.map +1 -1
- package/dist/state/global-config.js +42 -36
- package/dist/state/global-config.js.map +1 -1
- package/dist/state/session-manager.js +2 -2
- package/dist/state/session-manager.js.map +1 -1
- package/dist/test/integration-helpers.d.ts +96 -0
- package/dist/test/integration-helpers.d.ts.map +1 -0
- package/dist/test/integration-helpers.js +171 -0
- package/dist/test/integration-helpers.js.map +1 -0
- package/package.json +17 -4
- package/dist/auth/cookie-jar.d.ts +0 -24
- package/dist/auth/cookie-jar.d.ts.map +0 -1
- package/dist/auth/cookie-jar.js +0 -45
- package/dist/auth/cookie-jar.js.map +0 -1
- package/dist/components/login/login.provider.d.ts +0 -2
- package/dist/components/login/login.provider.d.ts.map +0 -1
- package/dist/components/login/login.provider.js +0 -2
- package/dist/components/login/login.provider.js.map +0 -1
- package/dist/components/login/login.store.d.ts +0 -2
- package/dist/components/login/login.store.d.ts.map +0 -1
- package/dist/components/login/login.store.js +0 -2
- package/dist/components/login/login.store.js.map +0 -1
- package/dist/state/directory-config.d.ts +0 -21
- package/dist/state/directory-config.d.ts.map +0 -1
- package/dist/state/directory-config.js +0 -59
- package/dist/state/directory-config.js.map +0 -1
- /package/{LICENSE.txt → LICENSE} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
## 0.0.3 (February 4, 2026)
|
|
2
|
+
|
|
3
|
+
- feat: Adds first time setup flow and setup command.
|
|
4
|
+
- chore: Uses SPDX identifier for license reference.
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
## 0.0.2 (January 30, 2026)
|
|
8
|
+
|
|
9
|
+
- Fixes issues when running in non interactive terminals
|
|
10
|
+
- Adds support to login with the STRAION_API_KEY environment variable
|
|
11
|
+
- Adds `--output-format` flag to all commands that accepts `json` and `text` values. It uses `text` by default which renders a rich terminal user interface.
|
|
12
|
+
|
|
13
|
+
|
|
1
14
|
## 0.0.1 (January 26, 2026)
|
|
2
15
|
|
|
3
16
|
- Initial release with login, logout, and session management
|
package/README.md
CHANGED
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,wBAAgB,aAAa,IAAI,OAAO,CAYvC"}
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from 'commander';
|
|
3
3
|
import packageJson from '../package.json' with { type: 'json' };
|
|
4
|
+
import { runDefaultCommand } from './commands/default.js';
|
|
4
5
|
import { registerCommands } from './commands/index.js';
|
|
5
6
|
export function createProgram() {
|
|
6
7
|
const program = new Command();
|
|
@@ -9,10 +10,7 @@ export function createProgram() {
|
|
|
9
10
|
.description('Straion CLI - The Missing Piece for AI-Era Software Engineering at Scale')
|
|
10
11
|
.version(packageJson.version);
|
|
11
12
|
registerCommands(program);
|
|
12
|
-
program.action(
|
|
13
|
-
const { runDefaultCommand } = await import('./commands/default.js');
|
|
14
|
-
await runDefaultCommand();
|
|
15
|
-
});
|
|
13
|
+
program.action(runDefaultCommand);
|
|
16
14
|
return program;
|
|
17
15
|
}
|
|
18
16
|
createProgram()
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,WAAW,MAAM,iBAAiB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAEhE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,MAAM,UAAU,aAAa;IAC3B,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;IAC9B,OAAO;SACJ,IAAI,CAAC,SAAS,CAAC;SACf,WAAW,CAAC,0EAA0E,CAAC;SACvF,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAEhC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAE1B,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,WAAW,MAAM,iBAAiB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAEhE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,MAAM,UAAU,aAAa;IAC3B,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;IAC9B,OAAO;SACJ,IAAI,CAAC,SAAS,CAAC;SACf,WAAW,CAAC,0EAA0E,CAAC;SACvF,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAEhC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAE1B,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;IAElC,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,aAAa,EAAE;KACZ,UAAU,EAAE;KACZ,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;IACX,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACjB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../src/commands/default.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../src/commands/default.tsx"],"names":[],"mappings":"AAQA,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAqBvD"}
|
package/dist/commands/default.js
CHANGED
|
@@ -1,41 +1,18 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { createCredentialManager } from '../auth/credentials.js';
|
|
3
|
-
import {
|
|
3
|
+
import { DefaultFlow } from '../components/default-flow.js';
|
|
4
4
|
import { renderInk } from '../lib/ink-render.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { resolveOrg } from '../state/directory-config.js';
|
|
5
|
+
import { createLogger } from '../lib/logger.js';
|
|
6
|
+
import { config } from '../state/global-config.js';
|
|
8
7
|
export async function runDefaultCommand() {
|
|
9
|
-
const logger =
|
|
8
|
+
const logger = createLogger();
|
|
10
9
|
try {
|
|
11
|
-
// Check if user is logged in
|
|
12
10
|
const credentialManager = await createCredentialManager();
|
|
13
11
|
const credentials = await credentialManager.getCredentials();
|
|
14
|
-
|
|
15
|
-
let organizations = null;
|
|
16
|
-
if (credentials) {
|
|
17
|
-
try {
|
|
18
|
-
const result = await loginUser(credentials.accessToken);
|
|
19
|
-
const resolvedOrg = resolveOrg(process.cwd());
|
|
20
|
-
// check with a successful login whether the user still has access to the local org
|
|
21
|
-
const stillHasAccessToOrg = resolvedOrg !== null &&
|
|
22
|
-
result.me.organizations.nodes.some((org) => org.id === resolvedOrg.id);
|
|
23
|
-
// set org to null if user no longer has access
|
|
24
|
-
localOrg = stillHasAccessToOrg ? resolvedOrg : null;
|
|
25
|
-
organizations = result.me.organizations.nodes;
|
|
26
|
-
}
|
|
27
|
-
catch (error) {
|
|
28
|
-
logger.error({
|
|
29
|
-
error: error instanceof Error ? error.message : String(error),
|
|
30
|
-
}, 'Error during login or organization resolution');
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
await renderInk(_jsx(Hero, { localOrg: localOrg, credentials: credentials, organizations: organizations }));
|
|
12
|
+
await renderInk(React.createElement(DefaultFlow, { logger: logger, credentials: credentials, defaultSetupDismissed: config.setupDismissed }));
|
|
34
13
|
}
|
|
35
14
|
catch (error) {
|
|
36
|
-
logger.error({
|
|
37
|
-
error: error instanceof Error ? error.message : String(error),
|
|
38
|
-
}, 'Error during rendering');
|
|
15
|
+
logger.error({ error: error instanceof Error ? error.message : String(error) }, 'Error during rendering');
|
|
39
16
|
process.exit(1);
|
|
40
17
|
}
|
|
41
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default.js","sourceRoot":"","sources":["../../src/commands/default.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"default.js","sourceRoot":"","sources":["../../src/commands/default.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAEnD,MAAM,CAAC,KAAK,UAAU,iBAAiB;IACrC,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;IAE9B,IAAI,CAAC;QACH,MAAM,iBAAiB,GAAG,MAAM,uBAAuB,EAAE,CAAC;QAC1D,MAAM,WAAW,GAAG,MAAM,iBAAiB,CAAC,cAAc,EAAE,CAAC;QAE7D,MAAM,SAAS,CACb,oBAAC,WAAW,IACV,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,qBAAqB,EAAE,MAAM,CAAC,cAAc,GAC5C,CACH,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,KAAK,CACV,EAAE,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EACjE,wBAAwB,CACzB,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-requirements.d.ts","sourceRoot":"","sources":["../../src/commands/find-requirements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,wBAAgB,6BAA6B,IAAI,OAAO,
|
|
1
|
+
{"version":3,"file":"find-requirements.d.ts","sourceRoot":"","sources":["../../src/commands/find-requirements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,wBAAgB,6BAA6B,IAAI,OAAO,CA6DvD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-requirements.integration.test.d.ts","sourceRoot":"","sources":["../../src/commands/find-requirements.integration.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Integration tests for the find-requirements command.
|
|
3
|
+
*/
|
|
4
|
+
import { graphql, HttpResponse } from 'msw';
|
|
5
|
+
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from 'vitest';
|
|
6
|
+
import { RequirementScopeClassification } from '../lib/graphql.js';
|
|
7
|
+
import { createMeHandler, IntegrationTestContext } from '../test/integration-helpers.js';
|
|
8
|
+
// Mock requirements data
|
|
9
|
+
const mockRequirements = [
|
|
10
|
+
{
|
|
11
|
+
requirementId: 'req-1',
|
|
12
|
+
content: 'Users must be able to log in with email and password',
|
|
13
|
+
scope: RequirementScopeClassification.InScope,
|
|
14
|
+
scopeReasoning: 'Core auth functionality',
|
|
15
|
+
collectionName: 'Security Requirements',
|
|
16
|
+
collectionId: 'col-1',
|
|
17
|
+
finalScore: 0.95,
|
|
18
|
+
scopeConfidence: 0.9,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
requirementId: 'req-2',
|
|
22
|
+
content: 'All API endpoints must validate input',
|
|
23
|
+
scope: RequirementScopeClassification.InScope,
|
|
24
|
+
scopeReasoning: 'Security best practice',
|
|
25
|
+
collectionName: 'Security Requirements',
|
|
26
|
+
collectionId: 'col-1',
|
|
27
|
+
finalScore: 0.9,
|
|
28
|
+
scopeConfidence: 0.8,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
requirementId: 'req-3',
|
|
32
|
+
content: 'Dashboard must load within 2 seconds',
|
|
33
|
+
scope: RequirementScopeClassification.Uncertain,
|
|
34
|
+
scopeReasoning: 'User experience',
|
|
35
|
+
collectionName: 'Performance Requirements',
|
|
36
|
+
collectionId: 'col-2',
|
|
37
|
+
finalScore: 0.75,
|
|
38
|
+
scopeConfidence: 0.2,
|
|
39
|
+
},
|
|
40
|
+
];
|
|
41
|
+
// GraphQL handler for requirements
|
|
42
|
+
const requirementsHandler = graphql.query('getMatchingRequirementsForTask', ({ request, variables }) => {
|
|
43
|
+
const authHeader = request.headers.get('Authorization');
|
|
44
|
+
if (authHeader !== 'Bearer valid-test-token') {
|
|
45
|
+
return HttpResponse.json({ errors: [{ message: 'Unauthorized' }] }, { status: 401 });
|
|
46
|
+
}
|
|
47
|
+
// Return empty results if no search criteria provided
|
|
48
|
+
if (!variables.title && !variables.body && !variables.summary) {
|
|
49
|
+
return HttpResponse.json({
|
|
50
|
+
data: { getMatchingRequirementsForTask: [] },
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return HttpResponse.json({
|
|
54
|
+
data: { getMatchingRequirementsForTask: mockRequirements },
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
const ctx = new IntegrationTestContext();
|
|
58
|
+
beforeAll(async () => {
|
|
59
|
+
await ctx.setupServer([createMeHandler(), requirementsHandler]);
|
|
60
|
+
});
|
|
61
|
+
beforeEach(() => {
|
|
62
|
+
ctx.setupConfigDir();
|
|
63
|
+
ctx.writeOrgConfig(); // find-requirements requires authenticated context
|
|
64
|
+
});
|
|
65
|
+
afterEach(() => {
|
|
66
|
+
ctx.cleanupConfigDir();
|
|
67
|
+
});
|
|
68
|
+
afterAll(() => {
|
|
69
|
+
ctx.cleanup();
|
|
70
|
+
});
|
|
71
|
+
describe('find-requirements command', () => {
|
|
72
|
+
it('shows formatted requirements list', async () => {
|
|
73
|
+
const result = await ctx.runCLI(['find-requirements', '--session', 'test-session', '--title', 'authentication'], { env: { STRAION_API_KEY: 'valid-test-token' } });
|
|
74
|
+
expect(result.stdout).toContain('Found 3 matching requirement(s)');
|
|
75
|
+
expect(result.stdout).toContain('Security Requirements');
|
|
76
|
+
expect(result.stdout).toContain('Performance Requirements');
|
|
77
|
+
expect(result.stdout).toContain('Users must be able to log in with email and password');
|
|
78
|
+
});
|
|
79
|
+
it('shows message when no requirements found', async () => {
|
|
80
|
+
const result = await ctx.runCLI(['find-requirements', '--session', 'test-session'], {
|
|
81
|
+
env: { STRAION_API_KEY: 'valid-test-token' },
|
|
82
|
+
});
|
|
83
|
+
expect(result.stdout).toContain('No matching requirements found');
|
|
84
|
+
});
|
|
85
|
+
it('groups requirements by collection', async () => {
|
|
86
|
+
const result = await ctx.runCLI(['find-requirements', '--session', 'test-session', '--title', 'test'], { env: { STRAION_API_KEY: 'valid-test-token' } });
|
|
87
|
+
// Should show collection headers
|
|
88
|
+
expect(result.stdout).toContain('Security Requirements');
|
|
89
|
+
expect(result.stdout).toContain('Performance Requirements');
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
//# sourceMappingURL=find-requirements.integration.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-requirements.integration.test.js","sourceRoot":"","sources":["../../src/commands/find-requirements.integration.test.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE1F,OAAO,EAAE,8BAA8B,EAAyB,MAAM,mBAAmB,CAAC;AAC1F,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAEzF,yBAAyB;AACzB,MAAM,gBAAgB,GAAuB;IAC3C;QACE,aAAa,EAAE,OAAO;QACtB,OAAO,EAAE,sDAAsD;QAC/D,KAAK,EAAE,8BAA8B,CAAC,OAAO;QAC7C,cAAc,EAAE,yBAAyB;QACzC,cAAc,EAAE,uBAAuB;QACvC,YAAY,EAAE,OAAO;QACrB,UAAU,EAAE,IAAI;QAChB,eAAe,EAAE,GAAG;KACrB;IACD;QACE,aAAa,EAAE,OAAO;QACtB,OAAO,EAAE,uCAAuC;QAChD,KAAK,EAAE,8BAA8B,CAAC,OAAO;QAC7C,cAAc,EAAE,wBAAwB;QACxC,cAAc,EAAE,uBAAuB;QAC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AAE;SAC7C,CAAC,CAAC;QAEH,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,gCAAgC,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mCAAmC,EAAE,KAAK,IAAI,EAAE;QACjD,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,CAC7B,CAAC,mBAAmB,EAAE,WAAW,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,CAAC,EACrE,EAAE,GAAG,EAAE,EAAE,eAAe,EAAE,kBAAkB,EAAE,EAAE,CACjD,CAAC;QAEF,iCAAiC;QACjC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,uBAAuB,CAAC,CAAC;QACzD,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,0BAA0B,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -18,16 +18,35 @@ export function createFindRequirementsCommand() {
|
|
|
18
18
|
summary: options.summary,
|
|
19
19
|
});
|
|
20
20
|
const requirements = response.getMatchingRequirementsForTask;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
catch (error) {
|
|
25
|
-
if (error instanceof Error) {
|
|
26
|
-
console.error(JSON.stringify({ error: error.message }));
|
|
21
|
+
// Text output: display requirements in readable format
|
|
22
|
+
if (requirements.length === 0) {
|
|
23
|
+
console.log('No matching requirements found.');
|
|
27
24
|
}
|
|
28
25
|
else {
|
|
29
|
-
console.
|
|
26
|
+
console.log(`Found ${requirements.length} matching requirement(s):\n`);
|
|
27
|
+
// Group requirements by collection
|
|
28
|
+
const byCollection = new Map();
|
|
29
|
+
for (const req of requirements) {
|
|
30
|
+
const collectionName = req.collectionName;
|
|
31
|
+
if (!byCollection.has(collectionName)) {
|
|
32
|
+
byCollection.set(collectionName, []);
|
|
33
|
+
}
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
35
|
+
byCollection.get(collectionName).push(req);
|
|
36
|
+
}
|
|
37
|
+
for (const [collectionName, reqs] of byCollection) {
|
|
38
|
+
console.log(`Collection name: ${collectionName}`);
|
|
39
|
+
console.log('Requirements:');
|
|
40
|
+
for (const req of reqs) {
|
|
41
|
+
console.log(`- ${req.content} [${req.scope}] Reason: ${req.scopeReasoning}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
30
44
|
}
|
|
45
|
+
logger.info({ requirements, title: options.title, body: options.body, summary: options.summary }, 'Fetched matching requirements');
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
49
|
+
console.error(`Error: ${errorMessage}`);
|
|
31
50
|
process.exit(1);
|
|
32
51
|
}
|
|
33
52
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-requirements.js","sourceRoot":"","sources":["../../src/commands/find-requirements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EACL,sCAAsC,GAGvC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,UAAU,6BAA6B;IAC3C,OAAO,IAAI,OAAO,CAAC,mBAAmB,CAAC;SACpC,cAAc,CAAC,gBAAgB,EAAE,mCAAmC,CAAC;SACrE,MAAM,CAAC,iBAAiB,EAAE,mBAAmB,EAAE,EAAE,CAAC;SAClD,MAAM,CAAC,eAAe,EAAE,0BAA0B,EAAE,EAAE,CAAC;SACvD,MAAM,CAAC,qBAAqB,EAAE,4BAA4B,EAAE,EAAE,CAAC;SAC/D,WAAW,CAAC,qDAAqD,CAAC;SAClE,MAAM,CACL,kBAAkB,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,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,EAAE,CAAC,CAAC;oBAC/E,CAAC;gBACH,CAAC;YACH,CAAC;YAED,MAAM,CAAC,IAAI,CACT,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,EACpF,+BAA+B,CAChC,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;YAE9E,OAAO,CAAC,KAAK,CAAC,UAAU,YAAY,EAAE,CAAC,CAAC;YACxC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CACH,CAAC;AACN,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQzC,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAMvD"}
|
package/dist/commands/index.js
CHANGED
|
@@ -2,10 +2,12 @@ import { createFindRequirementsCommand } from './find-requirements.js';
|
|
|
2
2
|
import { createLoginCommand } from './login.js';
|
|
3
3
|
import { createLogoutCommand } from './logout.js';
|
|
4
4
|
import { createSessionStartCommand } from './session-start.js';
|
|
5
|
+
import { createSetupCommand } from './setup.js';
|
|
5
6
|
export function registerCommands(program) {
|
|
6
7
|
program.addCommand(createSessionStartCommand());
|
|
7
8
|
program.addCommand(createLoginCommand());
|
|
8
9
|
program.addCommand(createLogoutCommand());
|
|
9
10
|
program.addCommand(createFindRequirementsCommand());
|
|
11
|
+
program.addCommand(createSetupCommand());
|
|
10
12
|
}
|
|
11
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,UAAU,gBAAgB,CAAC,OAAgB;IAC/C,OAAO,CAAC,UAAU,CAAC,yBAAyB,EAAE,CAAC,CAAC;IAChD,OAAO,CAAC,UAAU,CAAC,kBAAkB,EAAE,CAAC,CAAC;IACzC,OAAO,CAAC,UAAU,CAAC,mBAAmB,EAAE,CAAC,CAAC;IAC1C,OAAO,CAAC,UAAU,CAAC,6BAA6B,EAAE,CAAC,CAAC;IACpD,OAAO,CAAC,UAAU,CAAC,kBAAkB,EAAE,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/commands/login.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/commands/login.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAWpC,wBAAgB,kBAAkB,IAAI,OAAO,CA8D5C"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Integration tests for the login command in non-interactive mode.
|
|
3
|
+
*
|
|
4
|
+
* These tests spawn the actual CLI as a child process to test real behavior
|
|
5
|
+
* in non-TTY environments (CI/CD, piped input, scripts).
|
|
6
|
+
*
|
|
7
|
+
* Uses MSW (Mock Service Worker) with @mswjs/http-middleware to spawn a real
|
|
8
|
+
* HTTP server that the CLI child process can connect to.
|
|
9
|
+
*
|
|
10
|
+
* Run with: pnpm nx test cli -- --run src/commands/login.integration.test.ts
|
|
11
|
+
*/
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=login.integration.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.integration.test.d.ts","sourceRoot":"","sources":["../../src/commands/login.integration.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Integration tests for the login command in non-interactive mode.
|
|
3
|
+
*
|
|
4
|
+
* These tests spawn the actual CLI as a child process to test real behavior
|
|
5
|
+
* in non-TTY environments (CI/CD, piped input, scripts).
|
|
6
|
+
*
|
|
7
|
+
* Uses MSW (Mock Service Worker) with @mswjs/http-middleware to spawn a real
|
|
8
|
+
* HTTP server that the CLI child process can connect to.
|
|
9
|
+
*
|
|
10
|
+
* Run with: pnpm nx test cli -- --run src/commands/login.integration.test.ts
|
|
11
|
+
*/
|
|
12
|
+
import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest';
|
|
13
|
+
import { createMeHandler, IntegrationTestContext } from '../test/integration-helpers.js';
|
|
14
|
+
const ctx = new IntegrationTestContext();
|
|
15
|
+
beforeAll(async () => {
|
|
16
|
+
await ctx.setupServer([createMeHandler()]);
|
|
17
|
+
});
|
|
18
|
+
afterEach(() => {
|
|
19
|
+
ctx.cleanupConfigDir();
|
|
20
|
+
});
|
|
21
|
+
afterAll(() => {
|
|
22
|
+
ctx.cleanup();
|
|
23
|
+
});
|
|
24
|
+
/**
|
|
25
|
+
* Run CLI for login tests.
|
|
26
|
+
* This is a wrapper that uses the context's mock server URL.
|
|
27
|
+
*/
|
|
28
|
+
function runLoginCLI(args, options = {}) {
|
|
29
|
+
// For login tests, we set up a minimal config dir just for the test run
|
|
30
|
+
// but don't write any credentials (since we're testing login itself)
|
|
31
|
+
ctx.setupConfigDir();
|
|
32
|
+
return ctx.runCLI(args, {
|
|
33
|
+
...options,
|
|
34
|
+
env: {
|
|
35
|
+
// Default to empty API key unless specified
|
|
36
|
+
STRAION_API_KEY: '',
|
|
37
|
+
...options.env,
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
describe('login command (non-interactive/integration)', () => {
|
|
42
|
+
it('exits with error when no token is provided in non-TTY mode', async () => {
|
|
43
|
+
const result = await runLoginCLI(['login'], {
|
|
44
|
+
env: {
|
|
45
|
+
STRAION_API_KEY: '',
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
// Should exit with error
|
|
49
|
+
expect(result.exitCode).not.toBe(0);
|
|
50
|
+
});
|
|
51
|
+
it('shows text success message with valid token', async () => {
|
|
52
|
+
const result = await runLoginCLI(['login', '--token', 'valid-test-token']);
|
|
53
|
+
console.log(result);
|
|
54
|
+
// Should show TUI success message
|
|
55
|
+
expect(result.stdout).toContain('Hello');
|
|
56
|
+
expect(result.stdout).toContain('Test');
|
|
57
|
+
expect(result.stdout).toContain('logged in successfully');
|
|
58
|
+
expect(result.exitCode).toBe(0);
|
|
59
|
+
});
|
|
60
|
+
it('shows text error message with invalid token', async () => {
|
|
61
|
+
const result = await runLoginCLI(['login', '--token', 'invalid-token']);
|
|
62
|
+
// Should show TUI error message
|
|
63
|
+
expect(result.stdout).toContain('Login failed');
|
|
64
|
+
expect(result.exitCode).not.toBe(0);
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
//# sourceMappingURL=login.integration.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.integration.test.js","sourceRoot":"","sources":["../../src/commands/login.integration.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9E,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAEzF,MAAM,GAAG,GAAG,IAAI,sBAAsB,EAAE,CAAC;AAEzC,SAAS,CAAC,KAAK,IAAI,EAAE;IACnB,MAAM,GAAG,CAAC,WAAW,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC;AAC7C,CAAC,CAAC,CAAC;AAEH,SAAS,CAAC,GAAG,EAAE;IACb,GAAG,CAAC,gBAAgB,EAAE,CAAC;AACzB,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,GAAG,EAAE;IACZ,GAAG,CAAC,OAAO,EAAE,CAAC;AAChB,CAAC,CAAC,CAAC;AAEH;;;GAGG;AACH,SAAS,WAAW,CAClB,IAAc,EACd,UAA8D,EAAE;IAEhE,wEAAwE;IACxE,qEAAqE;IACrE,GAAG,CAAC,cAAc,EAAE,CAAC;IAErB,OAAO,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE;QACtB,GAAG,OAAO;QACV,GAAG,EAAE;YACH,4CAA4C;YAC5C,eAAe,EAAE,EAAE;YACnB,GAAG,OAAO,CAAC,GAAG;SACf;KACF,CAAC,CAAC;AACL,CAAC;AAED,QAAQ,CAAC,6CAA6C,EAAE,GAAG,EAAE;IAC3D,EAAE,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AC"}
|
package/dist/commands/login.js
CHANGED
|
@@ -1,20 +1,31 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
import { Command } from 'commander';
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import { createCredentialManager } from '../auth/credentials.js';
|
|
4
4
|
import { LoginFlow } from '../components/login/login-flow.js';
|
|
5
5
|
import {} from '../lib/graphql.js';
|
|
6
6
|
import { createInkPromise, renderInk } from '../lib/ink-render.js';
|
|
7
7
|
import { withLogging } from '../lib/middleware.js';
|
|
8
|
-
import {
|
|
8
|
+
import { config, saveConfig } from '../state/global-config.js';
|
|
9
9
|
export function createLoginCommand() {
|
|
10
10
|
return new Command('login')
|
|
11
11
|
.description('Authenticate with a Personal Access Token')
|
|
12
12
|
.option('--token <token>', 'Personal Access Token')
|
|
13
13
|
.action(withLogging(async (options, { logger }) => {
|
|
14
14
|
try {
|
|
15
|
+
// Token resolution: --token flag takes precedence over env var
|
|
16
|
+
const token = options.token || process.env.STRAION_API_KEY;
|
|
17
|
+
const tokenSource = options.token
|
|
18
|
+
? 'flag'
|
|
19
|
+
: process.env.STRAION_API_KEY
|
|
20
|
+
? 'env'
|
|
21
|
+
: 'input';
|
|
22
|
+
const skipOrgSelection = !!token;
|
|
23
|
+
logger.info({ tokenSource }, 'Starting login process');
|
|
15
24
|
const { promise, resolve, reject } = createInkPromise();
|
|
16
|
-
|
|
25
|
+
logger.debug('Rendering TUI for login flow');
|
|
26
|
+
await renderInk(React.createElement(LoginFlow, { defaultPat: token, tokenSource: tokenSource, skipOrgSelection: skipOrgSelection, onComplete: (user, org, pat) => resolve({ user, org, pat }), onError: (error) => reject(error) }));
|
|
17
27
|
const { user, org, pat } = await promise;
|
|
28
|
+
logger.info({ userId: user.id, orgId: org.id }, 'Login successful');
|
|
18
29
|
// Store credentials in secure storage
|
|
19
30
|
const credentialManager = await createCredentialManager();
|
|
20
31
|
await credentialManager.setCredentials({
|
|
@@ -22,14 +33,18 @@ export function createLoginCommand() {
|
|
|
22
33
|
name: user.firstName ?? user.name,
|
|
23
34
|
accessToken: pat,
|
|
24
35
|
});
|
|
36
|
+
logger.debug('Stored user credentials in credential manager');
|
|
25
37
|
// Store global org
|
|
26
|
-
|
|
38
|
+
config.globalOrg = org;
|
|
39
|
+
saveConfig();
|
|
40
|
+
logger.debug(`Set global organization to ${org.name} (${org.id})`);
|
|
27
41
|
}
|
|
28
42
|
catch (error) {
|
|
29
43
|
logger.error({
|
|
30
44
|
error: error instanceof Error ? error.message : String(error),
|
|
31
45
|
}, 'Error during login');
|
|
32
|
-
|
|
46
|
+
// Use setImmediate to allow stdout to flush before exiting
|
|
47
|
+
setImmediate(() => process.exit(1));
|
|
33
48
|
}
|
|
34
49
|
}));
|
|
35
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../src/commands/login.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../src/commands/login.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAE9D,OAAO,EAAwD,MAAM,mBAAmB,CAAC;AACzF,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE/D,MAAM,UAAU,kBAAkB;IAChC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;SACxB,WAAW,CAAC,2CAA2C,CAAC;SACxD,MAAM,CAAC,iBAAiB,EAAE,uBAAuB,CAAC;SAClD,MAAM,CACL,WAAW,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D,MAAM,iBAAiB,CAAC,cAAc,CAAC;gBACrC,MAAM,EAAE,IAAI,CAAC,EAAE;gBACf,IAAI,EAAE,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,IAAI;gBACjC,WAAW,EAAE,GAAG;aACjB,CAAC,CAAC;YACH,MAAM,CAAC,KAAK,CAAC,+CAA+C,CAAC,CAAC;YAC9D,mBAAmB;YACnB,MAAM,CAAC,SAAS,GAAG,GAAG,CAAC;YACvB,UAAU,EAAE,CAAC;YACb,MAAM,CAAC,KAAK,CAAC,8BAA8B,GAAG,CAAC,IAAI,KAAK,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;QACrE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,KAAK,CACV;gBACE,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;aAC9D,EACD,oBAAoB,CACrB,CAAC;YACF,2DAA2D;YAC3D,YAAY,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACtC,CAAC;IACH,CAAC,CAAC,CACH,CAAC;AACN,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../src/commands/logout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,wBAAgB,mBAAmB,IAAI,OAAO,
|
|
1
|
+
{"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../src/commands/logout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,wBAAgB,mBAAmB,IAAI,OAAO,CA0B7C"}
|
package/dist/commands/logout.js
CHANGED
|
@@ -1,30 +1,25 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
1
|
import { Command } from 'commander';
|
|
3
2
|
import { Box, Text } from 'ink';
|
|
3
|
+
import React from 'react';
|
|
4
4
|
import { createCredentialManager } from '../auth/credentials.js';
|
|
5
5
|
import { renderInk } from '../lib/ink-render.js';
|
|
6
6
|
import { withLogging } from '../lib/middleware.js';
|
|
7
|
-
import { globalConfig } from '../state/global-config.js';
|
|
8
7
|
export function createLogoutCommand() {
|
|
9
8
|
return new Command('logout').description('Log out and clear stored credentials').action(withLogging(async (_, { logger }) => {
|
|
10
9
|
try {
|
|
11
10
|
// Clear credentials from keychain
|
|
12
11
|
const credentialManager = await createCredentialManager();
|
|
13
12
|
await credentialManager.deleteCredentials();
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
await renderInk(_jsx(Box, { flexDirection: "column", borderStyle: "single", paddingLeft: 1, children: _jsx(Text, { color: "green", children: "\u2713 Logged out successfully." }) }));
|
|
13
|
+
await renderInk(React.createElement(Box, { flexDirection: "column", borderStyle: "single", paddingLeft: 1 },
|
|
14
|
+
React.createElement(Text, { color: "green" }, "\u2713 Logged out successfully.")));
|
|
17
15
|
}
|
|
18
16
|
catch (error) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
logger.error({
|
|
26
|
-
error: error instanceof Error ? error.message : 'Unknown error',
|
|
27
|
-
}, 'Logout command failed');
|
|
17
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
18
|
+
await renderInk(React.createElement(Box, { flexDirection: "column", borderStyle: "single", paddingLeft: 1 },
|
|
19
|
+
React.createElement(Text, { color: "red" },
|
|
20
|
+
"\u2717 Logout failed: ",
|
|
21
|
+
errorMessage)));
|
|
22
|
+
logger.error({ error: errorMessage }, 'Logout command failed');
|
|
28
23
|
process.exit(1);
|
|
29
24
|
}
|
|
30
25
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logout.js","sourceRoot":"","sources":["../../src/commands/logout.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"logout.js","sourceRoot":"","sources":["../../src/commands/logout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,MAAM,UAAU,mBAAmB;IACjC,OAAO,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC,WAAW,CAAC,sCAAsC,CAAC,CAAC,MAAM,CACrF,WAAW,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;QAClC,IAAI,CAAC;YACH,kCAAkC;YAClC,MAAM,iBAAiB,GAAG,MAAM,uBAAuB,EAAE,CAAC;YAC1D,MAAM,iBAAiB,CAAC,iBAAiB,EAAE,CAAC;YAE5C,MAAM,SAAS,CACb,oBAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,WAAW,EAAC,QAAQ,EAAC,WAAW,EAAE,CAAC;gBAC7D,oBAAC,IAAI,IAAC,KAAK,EAAC,OAAO,sCAAkC,CACjD,CACP,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;YAE9E,MAAM,SAAS,CACb,oBAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,WAAW,EAAC,QAAQ,EAAC,WAAW,EAAE,CAAC;gBAC7D,oBAAC,IAAI,IAAC,KAAK,EAAC,KAAK;;oBAAmB,YAAY,CAAQ,CACpD,CACP,CAAC;YACF,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,uBAAuB,CAAC,CAAC;YAC/D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-start.d.ts","sourceRoot":"","sources":["../../src/commands/session-start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,yBAAyB,IAAI,OAAO,
|
|
1
|
+
{"version":3,"file":"session-start.d.ts","sourceRoot":"","sources":["../../src/commands/session-start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,yBAAyB,IAAI,OAAO,CAWnD"}
|
|
@@ -4,10 +4,9 @@ export function createSessionStartCommand() {
|
|
|
4
4
|
return new Command('session-start')
|
|
5
5
|
.description('Initialize a Straion session for the current directory')
|
|
6
6
|
.requiredOption('--session <id>', 'Session ID from the calling agent')
|
|
7
|
-
.action(withAuthAndLogging(async (
|
|
7
|
+
.action(withAuthAndLogging(async (_, { logger, organization }) => {
|
|
8
8
|
logger.info('Session start initiated');
|
|
9
9
|
logger.info({ orgId: organization.id }, 'Session started successfully');
|
|
10
|
-
console.log(`${String.fromCodePoint(0x1f43f)} Straion session started...`);
|
|
11
10
|
}));
|
|
12
11
|
}
|
|
13
12
|
//# sourceMappingURL=session-start.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-start.js","sourceRoot":"","sources":["../../src/commands/session-start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,UAAU,yBAAyB;IACvC,OAAO,IAAI,OAAO,CAAC,eAAe,CAAC;SAChC,WAAW,CAAC,wDAAwD,CAAC;SACrE,cAAc,CAAC,gBAAgB,EAAE,mCAAmC,CAAC;SACrE,MAAM,CACL,kBAAkB,CAAC,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"session-start.js","sourceRoot":"","sources":["../../src/commands/session-start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,UAAU,yBAAyB;IACvC,OAAO,IAAI,OAAO,CAAC,eAAe,CAAC;SAChC,WAAW,CAAC,wDAAwD,CAAC;SACrE,cAAc,CAAC,gBAAgB,EAAE,mCAAmC,CAAC;SACrE,MAAM,CACL,kBAAkB,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE;QACvD,MAAM,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;QAEvC,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,YAAY,CAAC,EAAE,EAAE,EAAE,8BAA8B,CAAC,CAAC;IAC1E,CAAC,CAAC,CACH,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/commands/setup.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA2BpC,wBAAgB,kBAAkB,IAAI,OAAO,CAO5C"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { Box, useApp } from 'ink';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Banner } from '../components/banner.js';
|
|
5
|
+
import { AgentSetup } from '../components/setup/agent-setup.js';
|
|
6
|
+
import { renderInk } from '../lib/ink-render.js';
|
|
7
|
+
import { withLogging } from '../lib/middleware.js';
|
|
8
|
+
function SetupCommand({ logger }) {
|
|
9
|
+
const { exit } = useApp();
|
|
10
|
+
return (React.createElement(Box, { flexDirection: "column", paddingY: 1, paddingX: 2 },
|
|
11
|
+
React.createElement(Banner, null),
|
|
12
|
+
React.createElement(AgentSetup, { logger: logger, onComplete: () => {
|
|
13
|
+
logger.info('Setup completed.');
|
|
14
|
+
exit();
|
|
15
|
+
} })));
|
|
16
|
+
}
|
|
17
|
+
export function createSetupCommand() {
|
|
18
|
+
return new Command('setup').description('Set up your coding agents to use Straion').action(withLogging(async (options, { logger }) => {
|
|
19
|
+
logger.info('Setup started.');
|
|
20
|
+
await renderInk(React.createElement(SetupCommand, { logger: logger }));
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../src/commands/setup.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAElC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,SAAS,YAAY,CAAC,EAAE,MAAM,EAAsB;IAClD,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,EAAE,CAAC;IAE1B,OAAO,CACL,oBAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC;QAClD,oBAAC,MAAM,OAAG;QACV,oBAAC,UAAU,IACT,MAAM,EAAE,MAAM,EACd,UAAU,EAAE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