@straion/cli 0.0.1

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 (128) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/LICENSE.txt +93 -0
  3. package/README.md +83 -0
  4. package/dist/auth/config.d.ts +4 -0
  5. package/dist/auth/config.d.ts.map +1 -0
  6. package/dist/auth/config.js +4 -0
  7. package/dist/auth/config.js.map +1 -0
  8. package/dist/auth/cookie-jar.d.ts +24 -0
  9. package/dist/auth/cookie-jar.d.ts.map +1 -0
  10. package/dist/auth/cookie-jar.js +45 -0
  11. package/dist/auth/cookie-jar.js.map +1 -0
  12. package/dist/auth/credentials.d.ts +56 -0
  13. package/dist/auth/credentials.d.ts.map +1 -0
  14. package/dist/auth/credentials.js +147 -0
  15. package/dist/auth/credentials.js.map +1 -0
  16. package/dist/auth/graphql-client.d.ts +3 -0
  17. package/dist/auth/graphql-client.d.ts.map +1 -0
  18. package/dist/auth/graphql-client.js +18 -0
  19. package/dist/auth/graphql-client.js.map +1 -0
  20. package/dist/cli.d.ts +4 -0
  21. package/dist/cli.d.ts.map +1 -0
  22. package/dist/cli.js +24 -0
  23. package/dist/cli.js.map +1 -0
  24. package/dist/commands/default.d.ts +2 -0
  25. package/dist/commands/default.d.ts.map +1 -0
  26. package/dist/commands/default.js +42 -0
  27. package/dist/commands/default.js.map +1 -0
  28. package/dist/commands/find-requirements.d.ts +3 -0
  29. package/dist/commands/find-requirements.d.ts.map +1 -0
  30. package/dist/commands/find-requirements.js +35 -0
  31. package/dist/commands/find-requirements.js.map +1 -0
  32. package/dist/commands/index.d.ts +3 -0
  33. package/dist/commands/index.d.ts.map +1 -0
  34. package/dist/commands/index.js +11 -0
  35. package/dist/commands/index.js.map +1 -0
  36. package/dist/commands/login.d.ts +3 -0
  37. package/dist/commands/login.d.ts.map +1 -0
  38. package/dist/commands/login.js +36 -0
  39. package/dist/commands/login.js.map +1 -0
  40. package/dist/commands/logout.d.ts +3 -0
  41. package/dist/commands/logout.d.ts.map +1 -0
  42. package/dist/commands/logout.js +32 -0
  43. package/dist/commands/logout.js.map +1 -0
  44. package/dist/commands/session-start.d.ts +3 -0
  45. package/dist/commands/session-start.d.ts.map +1 -0
  46. package/dist/commands/session-start.js +13 -0
  47. package/dist/commands/session-start.js.map +1 -0
  48. package/dist/components/button.d.ts +7 -0
  49. package/dist/components/button.d.ts.map +1 -0
  50. package/dist/components/button.js +18 -0
  51. package/dist/components/button.js.map +1 -0
  52. package/dist/components/hero.d.ts +10 -0
  53. package/dist/components/hero.d.ts.map +1 -0
  54. package/dist/components/hero.js +39 -0
  55. package/dist/components/hero.js.map +1 -0
  56. package/dist/components/link.d.ts +43 -0
  57. package/dist/components/link.d.ts.map +1 -0
  58. package/dist/components/link.js +6 -0
  59. package/dist/components/link.js.map +1 -0
  60. package/dist/components/login/login-flow.d.ts +9 -0
  61. package/dist/components/login/login-flow.d.ts.map +1 -0
  62. package/dist/components/login/login-flow.js +98 -0
  63. package/dist/components/login/login-flow.js.map +1 -0
  64. package/dist/components/login/login-flow.test.d.ts +2 -0
  65. package/dist/components/login/login-flow.test.d.ts.map +1 -0
  66. package/dist/components/login/login-flow.test.js +139 -0
  67. package/dist/components/login/login-flow.test.js.map +1 -0
  68. package/dist/components/login/login.provider.d.ts +2 -0
  69. package/dist/components/login/login.provider.d.ts.map +1 -0
  70. package/dist/components/login/login.provider.js +2 -0
  71. package/dist/components/login/login.provider.js.map +1 -0
  72. package/dist/components/login/login.store.d.ts +2 -0
  73. package/dist/components/login/login.store.d.ts.map +1 -0
  74. package/dist/components/login/login.store.js +2 -0
  75. package/dist/components/login/login.store.js.map +1 -0
  76. package/dist/components/org-selector.d.ts +9 -0
  77. package/dist/components/org-selector.d.ts.map +1 -0
  78. package/dist/components/org-selector.js +33 -0
  79. package/dist/components/org-selector.js.map +1 -0
  80. package/dist/components/pat-input.d.ts +6 -0
  81. package/dist/components/pat-input.d.ts.map +1 -0
  82. package/dist/components/pat-input.js +42 -0
  83. package/dist/components/pat-input.js.map +1 -0
  84. package/dist/components/pat-input.test.d.ts +2 -0
  85. package/dist/components/pat-input.test.d.ts.map +1 -0
  86. package/dist/components/pat-input.test.js +82 -0
  87. package/dist/components/pat-input.test.js.map +1 -0
  88. package/dist/components/spinner.d.ts +2 -0
  89. package/dist/components/spinner.d.ts.map +1 -0
  90. package/dist/components/spinner.js +20 -0
  91. package/dist/components/spinner.js.map +1 -0
  92. package/dist/components/tabs.d.ts +35 -0
  93. package/dist/components/tabs.d.ts.map +1 -0
  94. package/dist/components/tabs.js +142 -0
  95. package/dist/components/tabs.js.map +1 -0
  96. package/dist/lib/graphql.d.ts +2081 -0
  97. package/dist/lib/graphql.d.ts.map +1 -0
  98. package/dist/lib/graphql.js +192 -0
  99. package/dist/lib/graphql.js.map +1 -0
  100. package/dist/lib/ink-render.d.ts +22 -0
  101. package/dist/lib/ink-render.d.ts.map +1 -0
  102. package/dist/lib/ink-render.js +33 -0
  103. package/dist/lib/ink-render.js.map +1 -0
  104. package/dist/lib/logger.d.ts +46 -0
  105. package/dist/lib/logger.d.ts.map +1 -0
  106. package/dist/lib/logger.js +88 -0
  107. package/dist/lib/logger.js.map +1 -0
  108. package/dist/lib/login.d.ts +28 -0
  109. package/dist/lib/login.d.ts.map +1 -0
  110. package/dist/lib/login.js +8 -0
  111. package/dist/lib/login.js.map +1 -0
  112. package/dist/lib/middleware.d.ts +35 -0
  113. package/dist/lib/middleware.d.ts.map +1 -0
  114. package/dist/lib/middleware.js +68 -0
  115. package/dist/lib/middleware.js.map +1 -0
  116. package/dist/state/directory-config.d.ts +21 -0
  117. package/dist/state/directory-config.d.ts.map +1 -0
  118. package/dist/state/directory-config.js +59 -0
  119. package/dist/state/directory-config.js.map +1 -0
  120. package/dist/state/global-config.d.ts +15 -0
  121. package/dist/state/global-config.d.ts.map +1 -0
  122. package/dist/state/global-config.js +59 -0
  123. package/dist/state/global-config.js.map +1 -0
  124. package/dist/state/session-manager.d.ts +33 -0
  125. package/dist/state/session-manager.d.ts.map +1 -0
  126. package/dist/state/session-manager.js +140 -0
  127. package/dist/state/session-manager.js.map +1 -0
  128. package/package.json +44 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,4 @@
1
+ ## 0.0.1 (January 26, 2026)
2
+
3
+ - Initial release with login, logout, and session management
4
+ - Added find-requirements command
package/LICENSE.txt ADDED
@@ -0,0 +1,93 @@
1
+ Elastic License 2.0
2
+
3
+ URL: https://www.elastic.co/licensing/elastic-license
4
+
5
+ ## Acceptance
6
+
7
+ By using the software, you agree to all of the terms and conditions below.
8
+
9
+ ## Copyright License
10
+
11
+ The licensor grants you a non-exclusive, royalty-free, worldwide,
12
+ non-sublicensable, non-transferable license to use, copy, distribute, make
13
+ available, and prepare derivative works of the software, in each case subject to
14
+ the limitations and conditions below.
15
+
16
+ ## Limitations
17
+
18
+ You may not provide the software to third parties as a hosted or managed
19
+ service, where the service provides users with access to any substantial set of
20
+ the features or functionality of the software.
21
+
22
+ You may not move, change, disable, or circumvent the license key functionality
23
+ in the software, and you may not remove or obscure any functionality in the
24
+ software that is protected by the license key.
25
+
26
+ You may not alter, remove, or obscure any licensing, copyright, or other notices
27
+ of the licensor in the software. Any use of the licensor’s trademarks is subject
28
+ to applicable law.
29
+
30
+ ## Patents
31
+
32
+ The licensor grants you a license, under any patent claims the licensor can
33
+ license, or becomes able to license, to make, have made, use, sell, offer for
34
+ sale, import and have imported the software, in each case subject to the
35
+ limitations and conditions in this license. This license does not cover any
36
+ patent claims that you cause to be infringed by modifications or additions to
37
+ the software. If you or your company make any written claim that the software
38
+ infringes or contributes to infringement of any patent, your patent license for
39
+ the software granted under these terms ends immediately. If your company makes
40
+ such a claim, your patent license ends immediately for work on behalf of your
41
+ company.
42
+
43
+ ## Notices
44
+
45
+ You must ensure that anyone who gets a copy of any part of the software from you
46
+ also gets a copy of these terms.
47
+
48
+ If you modify the software, you must include in any modified copies of the
49
+ software prominent notices stating that you have modified the software.
50
+
51
+ ## No Other Rights
52
+
53
+ These terms do not imply any licenses other than those expressly granted in
54
+ these terms.
55
+
56
+ ## Termination
57
+
58
+ If you use the software in violation of these terms, such use is not licensed,
59
+ and your licenses will automatically terminate. If the licensor provides you
60
+ with a notice of your violation, and you cease all violation of this license no
61
+ later than 30 days after you receive that notice, your licenses will be
62
+ reinstated retroactively. However, if you violate these terms after such
63
+ reinstatement, any additional violation of these terms will cause your licenses
64
+ to terminate automatically and permanently.
65
+
66
+ ## No Liability
67
+
68
+ *As far as the law allows, the software comes as is, without any warranty or
69
+ condition, and the licensor will not be liable to you for any damages arising
70
+ out of these terms or the use or nature of the software, under any kind of
71
+ legal claim.*
72
+
73
+ ## Definitions
74
+
75
+ The **licensor** is the entity offering these terms, and the **software** is the
76
+ software the licensor makes available under these terms, including any portion
77
+ of it.
78
+
79
+ **you** refers to the individual or entity agreeing to these terms.
80
+
81
+ **your company** is any legal entity, sole proprietorship, or other kind of
82
+ organization that you work for, plus all organizations that have control over,
83
+ are under the control of, or are under common control with that
84
+ organization. **control** means ownership of substantially all the assets of an
85
+ entity, or the power to direct its management and policies by vote, contract, or
86
+ otherwise. Control can be direct or indirect.
87
+
88
+ **your licenses** are all the licenses granted to you for the software under
89
+ these terms.
90
+
91
+ **use** means anything you do with the software requiring one of your licenses.
92
+
93
+ **trademark** means trademarks, service marks, and similar rights.
package/README.md ADDED
@@ -0,0 +1,83 @@
1
+ # Straion CLI (beta)
2
+
3
+ > **Note:** This CLI is currently in beta. Features may change and we appreciate your feedback. For questions or issues, please contact [support@straion.com](mailto:support@straion.com).
4
+
5
+ ```
6
+ ███████╗████████╗██████╗ █████╗ ██╗ ██████╗ ███╗ ██╗
7
+ ██╔════╝╚══██╔══╝██╔══██╗██╔══██╗██║██╔═══██╗████╗ ██║
8
+ ███████╗ ██║ ██████╔╝███████║██║██║ ██║██╔██╗ ██║
9
+ ╚════██║ ██║ ██╔══██╗██╔══██║██║██║ ██║██║╚██╗██║
10
+ ███████║ ██║ ██║ ██║██║ ██║██║╚██████╔╝██║ ╚████║
11
+ ╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═════╝ ╚═╝ ╚═══╝
12
+ ```
13
+
14
+ **The Missing Piece for AI-Era Software Engineering at Scale**
15
+
16
+ The Straion CLI provides command-line access to the Straion platform, enabling seamless integration with AI coding agents and developer workflows.
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ # npm
22
+ # globally
23
+ npm install -g @straion/cli
24
+
25
+ # inside project
26
+ npm install -save-dev @straion/cli
27
+
28
+ #pnpm
29
+ # globally
30
+ pnpm install -g @straion/cli
31
+
32
+ # inside project
33
+ pnpm install -save-dev @straion/cli
34
+ ```
35
+
36
+ ## Requirements
37
+
38
+ - Node.js 22.0.0 or higher
39
+
40
+ ## Quick Start
41
+
42
+ ```bash
43
+ # Display the interactive welcome screen
44
+ straion
45
+
46
+ # Or authenticate with your Personal Access Token
47
+ # This stores login information securely and makes it available on your machine.
48
+ straion login
49
+ ```
50
+
51
+ ## Commands
52
+
53
+ | Command | Description |
54
+ | ------------------------------- | -------------------------------------------------- |
55
+ | `straion` | Display the interactive welcome screen with status |
56
+ | `straion login` | Authenticate with a Personal Access Token |
57
+ | `straion login --token <token>` | Authenticate with a provided token |
58
+ | `straion logout` | Log out and clear stored credentials |
59
+ | `straion --help` | Show all available commands |
60
+ | `straion --version` | Display the current version |
61
+
62
+ ## Authentication
63
+
64
+ The CLI uses Personal Access Tokens (PAT) for authentication. Credentials are securely stored in your system's keychain.
65
+
66
+ 1. Generate a PAT inside your [user settings](https://www.straion.app/auth/login?redirectUrl=%2Fsettings%2Fuser-tokens)
67
+ 2. Run `straion login` and enter your token when prompted
68
+ 3. Your credentials will be securely stored for future sessions
69
+
70
+ ## Multi-Organization Support
71
+
72
+ If you belong to multiple organizations, the CLI allows you to switch between them:
73
+
74
+ 1. Run `straion` to view the interactive welcome screen
75
+ 2. Select "Switch Organization" to change your active organization
76
+
77
+ ## Learn More
78
+
79
+ Visit [https://www.straion.com](https://www.straion.com) for additional information.
80
+
81
+ ## License
82
+
83
+ See [LICENSE.txt](./LICENSE.txt) for details.
@@ -0,0 +1,4 @@
1
+ export declare const StraionCLIConfig: {
2
+ readonly serviceName: "straion-cli";
3
+ };
4
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/auth/config.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB;;CAEnB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export const StraionCLIConfig = {
2
+ serviceName: 'straion-cli',
3
+ };
4
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/auth/config.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,WAAW,EAAE,aAAa;CAClB,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Secure cookie storage for HTTP-only refresh token cookies
3
+ * Stores the raw Set-Cookie header value in the system keychain
4
+ */
5
+ export declare const REFRESH_TOKEN_COOKIE = "___refresh_token";
6
+ export declare class CookieJar {
7
+ /**
8
+ * Store the refresh token cookie (the full Set-Cookie header value)
9
+ */
10
+ setRefreshTokenCookie(setCookieHeader: string): Promise<void>;
11
+ /**
12
+ * Retrieve the stored refresh token cookie
13
+ */
14
+ getRefreshTokenCookie(): Promise<string | null>;
15
+ /**
16
+ * Clear the stored refresh token cookie
17
+ */
18
+ clearRefreshTokenCookie(): Promise<boolean>;
19
+ }
20
+ /**
21
+ * Factory function to create the appropriate cookie jar
22
+ */
23
+ export declare function createCookieJar(): Promise<CookieJar>;
24
+ //# sourceMappingURL=cookie-jar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cookie-jar.d.ts","sourceRoot":"","sources":["../../src/auth/cookie-jar.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,eAAO,MAAM,oBAAoB,qBAAqB,CAAC;AAGvD,qBAAa,SAAS;IACpB;;OAEG;IACG,qBAAqB,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAInE;;OAEG;IACG,qBAAqB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAIrD;;OAEG;IACG,uBAAuB,IAAI,OAAO,CAAC,OAAO,CAAC;CAGlD;AAED;;GAEG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,SAAS,CAAC,CAW1D"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Secure cookie storage for HTTP-only refresh token cookies
3
+ * Stores the raw Set-Cookie header value in the system keychain
4
+ */
5
+ import * as keytar from 'keytar';
6
+ import { StraionCLIConfig } from './config.js';
7
+ /** TODO FFR: use shared config between gateway and cli */
8
+ const AUTH_TOKEN_COOKIE = '___auth_token';
9
+ export const REFRESH_TOKEN_COOKIE = '___refresh_token';
10
+ const ORGANIZATION_COOKIE = '___organization_id';
11
+ export class CookieJar {
12
+ /**
13
+ * Store the refresh token cookie (the full Set-Cookie header value)
14
+ */
15
+ async setRefreshTokenCookie(setCookieHeader) {
16
+ await keytar.setPassword(StraionCLIConfig.serviceName, REFRESH_TOKEN_COOKIE, setCookieHeader);
17
+ }
18
+ /**
19
+ * Retrieve the stored refresh token cookie
20
+ */
21
+ async getRefreshTokenCookie() {
22
+ return keytar.getPassword(StraionCLIConfig.serviceName, REFRESH_TOKEN_COOKIE);
23
+ }
24
+ /**
25
+ * Clear the stored refresh token cookie
26
+ */
27
+ async clearRefreshTokenCookie() {
28
+ return keytar.deletePassword(StraionCLIConfig.serviceName, REFRESH_TOKEN_COOKIE);
29
+ }
30
+ }
31
+ /**
32
+ * Factory function to create the appropriate cookie jar
33
+ */
34
+ export async function createCookieJar() {
35
+ try {
36
+ // Test if keytar works
37
+ await keytar.getPassword(StraionCLIConfig.serviceName, '__cookie_test__');
38
+ return new CookieJar();
39
+ }
40
+ catch {
41
+ console.error('System keychain unavailable. The straion cli requires a keychain to securely store authentication tokens.');
42
+ throw new Error('System keychain unavailable');
43
+ }
44
+ }
45
+ //# sourceMappingURL=cookie-jar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cookie-jar.js","sourceRoot":"","sources":["../../src/auth/cookie-jar.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,0DAA0D;AAC1D,MAAM,iBAAiB,GAAG,eAAe,CAAC;AAC1C,MAAM,CAAC,MAAM,oBAAoB,GAAG,kBAAkB,CAAC;AACvD,MAAM,mBAAmB,GAAG,oBAAoB,CAAC;AAEjD,MAAM,OAAO,SAAS;IACpB;;OAEG;IACH,KAAK,CAAC,qBAAqB,CAAC,eAAuB;QACjD,MAAM,MAAM,CAAC,WAAW,CAAC,gBAAgB,CAAC,WAAW,EAAE,oBAAoB,EAAE,eAAe,CAAC,CAAC;IAChG,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,qBAAqB;QACzB,OAAO,MAAM,CAAC,WAAW,CAAC,gBAAgB,CAAC,WAAW,EAAE,oBAAoB,CAAC,CAAC;IAChF,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,uBAAuB;QAC3B,OAAO,MAAM,CAAC,cAAc,CAAC,gBAAgB,CAAC,WAAW,EAAE,oBAAoB,CAAC,CAAC;IACnF,CAAC;CACF;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe;IACnC,IAAI,CAAC;QACH,uBAAuB;QACvB,MAAM,MAAM,CAAC,WAAW,CAAC,gBAAgB,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC;QAC1E,OAAO,IAAI,SAAS,EAAE,CAAC;IACzB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,CAAC,KAAK,CACX,2GAA2G,CAC5G,CAAC;QACF,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;IACjD,CAAC;AACH,CAAC"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Cross-platform secure credential storage using OS-native keychains:
3
+ * - macOS: Keychain
4
+ * - Windows: Credential Manager
5
+ * - Linux: libsecret
6
+ */
7
+ /**
8
+ * Auth credentials stored in the secure keychain.
9
+ * Organization preferences are stored separately in src/state/.
10
+ */
11
+ export interface StoredCredentials {
12
+ userId: string;
13
+ name: string;
14
+ accessToken: string;
15
+ }
16
+ export declare class CredentialManager {
17
+ /**
18
+ * Store credentials securely in the system keychain
19
+ */
20
+ setCredentials(credentials: StoredCredentials): Promise<void>;
21
+ /**
22
+ * Retrieve the currently stored credentials
23
+ */
24
+ getCredentials(): Promise<StoredCredentials | null>;
25
+ /**
26
+ * Get the access token only (convenience method)
27
+ */
28
+ getAccessToken(): Promise<string | null>;
29
+ /**
30
+ * Delete all stored credentials for the current user
31
+ */
32
+ deleteCredentials(): Promise<boolean>;
33
+ }
34
+ /**
35
+ * Fallback credential manager using a config file
36
+ * Use this when keytar is unavailable (e.g., headless Linux without libsecret)
37
+ */
38
+ export declare class FileCredentialManager {
39
+ private configPath;
40
+ private encryptionKey;
41
+ constructor();
42
+ private encrypt;
43
+ private decrypt;
44
+ setCredentials(credentials: StoredCredentials): Promise<void>;
45
+ getCredentials(): Promise<StoredCredentials | null>;
46
+ deleteCredentials(): Promise<boolean>;
47
+ /**
48
+ * Check if valid credentials exist
49
+ */
50
+ isAuthenticated(): Promise<boolean>;
51
+ }
52
+ /**
53
+ * Factory function to create the appropriate credential manager
54
+ */
55
+ export declare function createCredentialManager(): Promise<CredentialManager | FileCredentialManager>;
56
+ //# sourceMappingURL=credentials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../src/auth/credentials.ts"],"names":[],"mappings":"AASA;;;;;GAKG;AAEH;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,iBAAiB;IAC5B;;OAEG;IACG,cAAc,CAAC,WAAW,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAanE;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAkBzD;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAK9C;;OAEG;IACG,iBAAiB,IAAI,OAAO,CAAC,OAAO,CAAC;CAQ5C;AAED;;;GAGG;AACH,qBAAa,qBAAqB;IAChC,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,aAAa,CAAS;;IAmB9B,OAAO,CAAC,OAAO;IAQf,OAAO,CAAC,OAAO;IAUT,cAAc,CAAC,WAAW,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAK7D,cAAc,IAAI,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAcnD,iBAAiB,IAAI,OAAO,CAAC,OAAO,CAAC;IAY3C;;OAEG;IACG,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC;CAI1C;AAED;;GAEG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CACtD,iBAAiB,GAAG,qBAAqB,CAC1C,CAUA"}
@@ -0,0 +1,147 @@
1
+ import { createCipheriv, createDecipheriv, randomBytes, scryptSync } from 'node:crypto';
2
+ import { existsSync, mkdirSync, readFileSync, unlinkSync, writeFileSync } from 'node:fs';
3
+ import { homedir, hostname, userInfo } from 'node:os';
4
+ import { join } from 'node:path';
5
+ import keytar from 'keytar';
6
+ import { StraionCLIConfig } from './config.js';
7
+ export class CredentialManager {
8
+ /**
9
+ * Store credentials securely in the system keychain
10
+ */
11
+ async setCredentials(credentials) {
12
+ const payload = JSON.stringify(credentials);
13
+ // Store the credentials as a JSON blob under the username key
14
+ try {
15
+ await keytar.setPassword(StraionCLIConfig.serviceName, '__current_login__', payload);
16
+ }
17
+ catch (error) {
18
+ if (error instanceof Error) {
19
+ console.error(error.message || 'Failed to store credentials in system keychain');
20
+ }
21
+ }
22
+ }
23
+ /**
24
+ * Retrieve the currently stored credentials
25
+ */
26
+ async getCredentials() {
27
+ try {
28
+ // Retrive the current login credentials
29
+ const payload = await keytar.getPassword(StraionCLIConfig.serviceName, '__current_login__');
30
+ if (!payload) {
31
+ return null;
32
+ }
33
+ const credentials = JSON.parse(payload);
34
+ return credentials;
35
+ }
36
+ catch {
37
+ console.error('Failed to retrieve credentials from system keychain');
38
+ return null;
39
+ }
40
+ }
41
+ /**
42
+ * Get the access token only (convenience method)
43
+ */
44
+ async getAccessToken() {
45
+ const credentials = await this.getCredentials();
46
+ return credentials?.accessToken ?? null;
47
+ }
48
+ /**
49
+ * Delete all stored credentials for the current user
50
+ */
51
+ async deleteCredentials() {
52
+ try {
53
+ await keytar.deletePassword(StraionCLIConfig.serviceName, '__current_login__');
54
+ return true;
55
+ }
56
+ catch {
57
+ return false;
58
+ }
59
+ }
60
+ }
61
+ /**
62
+ * Fallback credential manager using a config file
63
+ * Use this when keytar is unavailable (e.g., headless Linux without libsecret)
64
+ */
65
+ export class FileCredentialManager {
66
+ configPath;
67
+ encryptionKey;
68
+ constructor() {
69
+ // Store in user's config directory
70
+ const configDir = process.env.XDG_CONFIG_HOME || join(homedir(), '.config', StraionCLIConfig.serviceName);
71
+ if (!existsSync(configDir)) {
72
+ mkdirSync(configDir, { recursive: true, mode: 0o700 });
73
+ }
74
+ this.configPath = join(configDir, 'credentials.enc');
75
+ // Derive encryption key from machine-specific data
76
+ // In production, consider a more robust key derivation strategy
77
+ const machineId = hostname() + userInfo().username;
78
+ this.encryptionKey = scryptSync(machineId, 'salt', 32);
79
+ }
80
+ encrypt(text) {
81
+ const iv = randomBytes(16);
82
+ const cipher = createCipheriv('aes-256-gcm', this.encryptionKey, iv);
83
+ const encrypted = Buffer.concat([cipher.update(text, 'utf8'), cipher.final()]);
84
+ const authTag = cipher.getAuthTag();
85
+ return Buffer.concat([iv, authTag, encrypted]).toString('base64');
86
+ }
87
+ decrypt(encryptedBase64) {
88
+ const data = Buffer.from(encryptedBase64, 'base64');
89
+ const iv = data.subarray(0, 16);
90
+ const authTag = data.subarray(16, 32);
91
+ const encrypted = data.subarray(32);
92
+ const decipher = createDecipheriv('aes-256-gcm', this.encryptionKey, iv);
93
+ decipher.setAuthTag(authTag);
94
+ return decipher.update(encrypted) + decipher.final('utf8');
95
+ }
96
+ async setCredentials(credentials) {
97
+ const encrypted = this.encrypt(JSON.stringify(credentials));
98
+ writeFileSync(this.configPath, encrypted, { mode: 0o600 });
99
+ }
100
+ async getCredentials() {
101
+ try {
102
+ if (!existsSync(this.configPath)) {
103
+ return null;
104
+ }
105
+ const encrypted = readFileSync(this.configPath, 'utf8');
106
+ const decrypted = this.decrypt(encrypted);
107
+ return JSON.parse(decrypted);
108
+ }
109
+ catch {
110
+ return null;
111
+ }
112
+ }
113
+ async deleteCredentials() {
114
+ try {
115
+ if (existsSync(this.configPath)) {
116
+ unlinkSync(this.configPath);
117
+ }
118
+ return true;
119
+ }
120
+ catch {
121
+ return false;
122
+ }
123
+ }
124
+ /**
125
+ * Check if valid credentials exist
126
+ */
127
+ async isAuthenticated() {
128
+ const credentials = await this.getCredentials();
129
+ return credentials !== null;
130
+ }
131
+ }
132
+ /**
133
+ * Factory function to create the appropriate credential manager
134
+ */
135
+ export async function createCredentialManager() {
136
+ try {
137
+ // Test if keytar works
138
+ await keytar.getPassword(StraionCLIConfig.serviceName, '__test__');
139
+ return new CredentialManager();
140
+ }
141
+ catch {
142
+ // Fall back to file-based storage
143
+ console.warn('System keychain unavailable, falling back to encrypted file storage.');
144
+ return new FileCredentialManager();
145
+ }
146
+ }
147
+ //# sourceMappingURL=credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credentials.js","sourceRoot":"","sources":["../../src/auth/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,E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ql-request';
2
+ export declare function getGraphqlClient(pat: string, organizationId?: string): GraphQLClient;
3
+ //# sourceMappingURL=graphql-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphql-client.d.ts","sourceRoot":"","sources":["../../src/auth/graphql-client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAMhD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,aAAa,CAYpF"}
@@ -0,0 +1,18 @@
1
+ import { env } from 'node:process';
2
+ import { GraphQLClient } from 'graphql-request';
3
+ const BASE_URL = env.STRAION_API_BASEURL || 'https://api.straion.app';
4
+ let initializedClient = null;
5
+ export function getGraphqlClient(pat, organizationId) {
6
+ if (!initializedClient) {
7
+ initializedClient = new GraphQLClient(BASE_URL, {
8
+ credentials: 'include',
9
+ headers: {
10
+ 'Content-Type': 'application/json',
11
+ Authorization: `Bearer ${pat}`,
12
+ ...(organizationId ? { 'x-straion-org-id': organizationId } : {}),
13
+ },
14
+ });
15
+ }
16
+ return initializedClient;
17
+ }
18
+ //# sourceMappingURL=graphql-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphql-client.js","sourceRoot":"","sources":["../../src/auth/graphql-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAEnC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,MAAM,QAAQ,GAAG,GAAG,CAAC,mBAAmB,IAAI,yBAAyB,CAAC;AAEtE,IAAI,iBAAiB,GAAyB,IAAI,CAAC;AAEnD,MAAM,UAAU,gBAAgB,CAAC,GAAW,EAAE,cAAuB;IACnE,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACvB,iBAAiB,GAAG,IAAI,aAAa,CAAC,QAAQ,EAAE;YAC9C,WAAW,EAAE,SAAS;YACtB,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,aAAa,EAAE,UAAU,GAAG,EAAE;gBAC9B,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAClE;SACF,CAAC,CAAC;IACL,CAAC;IACD,OAAO,iBAAiB,CAAC;AAC3B,CAAC"}
package/dist/cli.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from 'commander';
3
+ export declare function createProgram(): Command;
4
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,wBAAgB,aAAa,IAAI,OAAO,CAevC"}
package/dist/cli.js ADDED
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from 'commander';
3
+ import packageJson from '../package.json' with { type: 'json' };
4
+ import { registerCommands } from './commands/index.js';
5
+ export function createProgram() {
6
+ const program = new Command();
7
+ program
8
+ .name('straion')
9
+ .description('Straion CLI - The Missing Piece for AI-Era Software Engineering at Scale')
10
+ .version(packageJson.version);
11
+ registerCommands(program);
12
+ program.action(async () => {
13
+ const { runDefaultCommand } = await import('./commands/default.js');
14
+ await runDefaultCommand();
15
+ });
16
+ return program;
17
+ }
18
+ createProgram()
19
+ .parseAsync()
20
+ .catch((e) => {
21
+ console.error(e);
22
+ process.exit(1);
23
+ });
24
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +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,KAAK,IAAI,EAAE;QACxB,MAAM,EAAE,iBAAiB,EAAE,GAAG,MAAM,MAAM,CAAC,uBAAuB,CAAC,CAAC;QACpE,MAAM,iBAAiB,EAAE,CAAC;IAC5B,CAAC,CAAC,CAAC;IAEH,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"}
@@ -0,0 +1,2 @@
1
+ export declare function runDefaultCommand(): Promise<void>;
2
+ //# sourceMappingURL=default.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../src/commands/default.tsx"],"names":[],"mappings":"AAOA,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CA4CvD"}
@@ -0,0 +1,42 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createCredentialManager } from '../auth/credentials.js';
3
+ import { Hero } from '../components/hero.js';
4
+ import { renderInk } from '../lib/ink-render.js';
5
+ import { createDefaultCommandLogger } from '../lib/logger.js';
6
+ import { loginUser } from '../lib/login.js';
7
+ import { resolveOrg } from '../state/directory-config.js';
8
+ export async function runDefaultCommand() {
9
+ const logger = createDefaultCommandLogger();
10
+ try {
11
+ // Check if user is logged in
12
+ const credentialManager = await createCredentialManager();
13
+ const credentials = await credentialManager.getCredentials();
14
+ let localOrg = null;
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 }));
34
+ }
35
+ catch (error) {
36
+ logger.error({
37
+ error: error instanceof Error ? error.message : String(error),
38
+ }, 'Error during rendering');
39
+ process.exit(1);
40
+ }
41
+ }
42
+ //# sourceMappingURL=default.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default.js","sourceRoot":"","sources":["../../src/commands/default.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE1D,MAAM,CAAC,KAAK,UAAU,iBAAiB;IACrC,MAAM,MAAM,GAAG,0BAA0B,EAAE,CAAC;IAE5C,IAAI,CAAC;QACH,6BAA6B;QAC7B,MAAM,iBAAiB,GAAG,MAAM,uBAAuB,EAAE,CAAC;QAC1D,MAAM,WAAW,GAAG,MA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CAAC;SAC9D,EACD,wBAAwB,CACzB,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function createFindRequirementsCommand(): Command;
3
+ //# sourceMappingURL=find-requirements.d.ts.map
@@ -0,0 +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,CAoCvD"}