@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.
- package/CHANGELOG.md +4 -0
- package/LICENSE.txt +93 -0
- package/README.md +83 -0
- package/dist/auth/config.d.ts +4 -0
- package/dist/auth/config.d.ts.map +1 -0
- package/dist/auth/config.js +4 -0
- package/dist/auth/config.js.map +1 -0
- package/dist/auth/cookie-jar.d.ts +24 -0
- package/dist/auth/cookie-jar.d.ts.map +1 -0
- package/dist/auth/cookie-jar.js +45 -0
- package/dist/auth/cookie-jar.js.map +1 -0
- package/dist/auth/credentials.d.ts +56 -0
- package/dist/auth/credentials.d.ts.map +1 -0
- package/dist/auth/credentials.js +147 -0
- package/dist/auth/credentials.js.map +1 -0
- package/dist/auth/graphql-client.d.ts +3 -0
- package/dist/auth/graphql-client.d.ts.map +1 -0
- package/dist/auth/graphql-client.js +18 -0
- package/dist/auth/graphql-client.js.map +1 -0
- package/dist/cli.d.ts +4 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +24 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/default.d.ts +2 -0
- package/dist/commands/default.d.ts.map +1 -0
- package/dist/commands/default.js +42 -0
- package/dist/commands/default.js.map +1 -0
- package/dist/commands/find-requirements.d.ts +3 -0
- package/dist/commands/find-requirements.d.ts.map +1 -0
- package/dist/commands/find-requirements.js +35 -0
- package/dist/commands/find-requirements.js.map +1 -0
- package/dist/commands/index.d.ts +3 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +11 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/login.d.ts +3 -0
- package/dist/commands/login.d.ts.map +1 -0
- package/dist/commands/login.js +36 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/logout.d.ts +3 -0
- package/dist/commands/logout.d.ts.map +1 -0
- package/dist/commands/logout.js +32 -0
- package/dist/commands/logout.js.map +1 -0
- package/dist/commands/session-start.d.ts +3 -0
- package/dist/commands/session-start.d.ts.map +1 -0
- package/dist/commands/session-start.js +13 -0
- package/dist/commands/session-start.js.map +1 -0
- package/dist/components/button.d.ts +7 -0
- package/dist/components/button.d.ts.map +1 -0
- package/dist/components/button.js +18 -0
- package/dist/components/button.js.map +1 -0
- package/dist/components/hero.d.ts +10 -0
- package/dist/components/hero.d.ts.map +1 -0
- package/dist/components/hero.js +39 -0
- package/dist/components/hero.js.map +1 -0
- package/dist/components/link.d.ts +43 -0
- package/dist/components/link.d.ts.map +1 -0
- package/dist/components/link.js +6 -0
- package/dist/components/link.js.map +1 -0
- package/dist/components/login/login-flow.d.ts +9 -0
- package/dist/components/login/login-flow.d.ts.map +1 -0
- package/dist/components/login/login-flow.js +98 -0
- package/dist/components/login/login-flow.js.map +1 -0
- package/dist/components/login/login-flow.test.d.ts +2 -0
- package/dist/components/login/login-flow.test.d.ts.map +1 -0
- package/dist/components/login/login-flow.test.js +139 -0
- package/dist/components/login/login-flow.test.js.map +1 -0
- package/dist/components/login/login.provider.d.ts +2 -0
- package/dist/components/login/login.provider.d.ts.map +1 -0
- package/dist/components/login/login.provider.js +2 -0
- package/dist/components/login/login.provider.js.map +1 -0
- package/dist/components/login/login.store.d.ts +2 -0
- package/dist/components/login/login.store.d.ts.map +1 -0
- package/dist/components/login/login.store.js +2 -0
- package/dist/components/login/login.store.js.map +1 -0
- package/dist/components/org-selector.d.ts +9 -0
- package/dist/components/org-selector.d.ts.map +1 -0
- package/dist/components/org-selector.js +33 -0
- package/dist/components/org-selector.js.map +1 -0
- package/dist/components/pat-input.d.ts +6 -0
- package/dist/components/pat-input.d.ts.map +1 -0
- package/dist/components/pat-input.js +42 -0
- package/dist/components/pat-input.js.map +1 -0
- package/dist/components/pat-input.test.d.ts +2 -0
- package/dist/components/pat-input.test.d.ts.map +1 -0
- package/dist/components/pat-input.test.js +82 -0
- package/dist/components/pat-input.test.js.map +1 -0
- package/dist/components/spinner.d.ts +2 -0
- package/dist/components/spinner.d.ts.map +1 -0
- package/dist/components/spinner.js +20 -0
- package/dist/components/spinner.js.map +1 -0
- package/dist/components/tabs.d.ts +35 -0
- package/dist/components/tabs.d.ts.map +1 -0
- package/dist/components/tabs.js +142 -0
- package/dist/components/tabs.js.map +1 -0
- package/dist/lib/graphql.d.ts +2081 -0
- package/dist/lib/graphql.d.ts.map +1 -0
- package/dist/lib/graphql.js +192 -0
- package/dist/lib/graphql.js.map +1 -0
- package/dist/lib/ink-render.d.ts +22 -0
- package/dist/lib/ink-render.d.ts.map +1 -0
- package/dist/lib/ink-render.js +33 -0
- package/dist/lib/ink-render.js.map +1 -0
- package/dist/lib/logger.d.ts +46 -0
- package/dist/lib/logger.d.ts.map +1 -0
- package/dist/lib/logger.js +88 -0
- package/dist/lib/logger.js.map +1 -0
- package/dist/lib/login.d.ts +28 -0
- package/dist/lib/login.d.ts.map +1 -0
- package/dist/lib/login.js +8 -0
- package/dist/lib/login.js.map +1 -0
- package/dist/lib/middleware.d.ts +35 -0
- package/dist/lib/middleware.d.ts.map +1 -0
- package/dist/lib/middleware.js +68 -0
- package/dist/lib/middleware.js.map +1 -0
- package/dist/state/directory-config.d.ts +21 -0
- package/dist/state/directory-config.d.ts.map +1 -0
- package/dist/state/directory-config.js +59 -0
- package/dist/state/directory-config.js.map +1 -0
- package/dist/state/global-config.d.ts +15 -0
- package/dist/state/global-config.d.ts.map +1 -0
- package/dist/state/global-config.js +59 -0
- package/dist/state/global-config.js.map +1 -0
- package/dist/state/session-manager.d.ts +33 -0
- package/dist/state/session-manager.d.ts.map +1 -0
- package/dist/state/session-manager.js +140 -0
- package/dist/state/session-manager.js.map +1 -0
- package/package.json +44 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
import type { OrganizationFragment } from './graphql.js';
|
|
3
|
+
import { type LoggingContext } from './logger.js';
|
|
4
|
+
export interface AuthContext {
|
|
5
|
+
accessToken: string;
|
|
6
|
+
organization: OrganizationFragment;
|
|
7
|
+
}
|
|
8
|
+
export type FullContext = AuthContext & LoggingContext;
|
|
9
|
+
/**
|
|
10
|
+
* Wrapper for command actions that provides logging only (no auth).
|
|
11
|
+
* Requires `--session <id>` option on the command
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* .action(withLogging(async (options, { logger }) => {
|
|
15
|
+
* logger.info('Command started');
|
|
16
|
+
* // With data: logger.info({ userId: '123' }, 'User action');
|
|
17
|
+
* }))
|
|
18
|
+
*/
|
|
19
|
+
export declare function withLogging<TOptions extends {
|
|
20
|
+
session: string;
|
|
21
|
+
}>(action: (options: TOptions, ctx: LoggingContext, command: Command) => Promise<void>): (this: Command, options: TOptions) => Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Wrapper for command actions that provides auth context and logging.
|
|
24
|
+
* Requires `--session <id>` option on the command.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* .action(withAuthAndLogging(async (options, { logger, accessToken, organization }) => {
|
|
28
|
+
* logger.info('Command started');
|
|
29
|
+
* // With data: logger.info({ orgId: organization.id }, 'Processing org');
|
|
30
|
+
* }))
|
|
31
|
+
*/
|
|
32
|
+
export declare function withAuthAndLogging<TOptions extends {
|
|
33
|
+
session: string;
|
|
34
|
+
}>(action: (options: TOptions, ctx: FullContext, command: Command) => Promise<void>): (this: Command, options: TOptions) => Promise<void>;
|
|
35
|
+
//# sourceMappingURL=middleware.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/lib/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKzC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAEvE,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,oBAAoB,CAAC;CACpC;AAED,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,cAAc,CAAC;AAEvD;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,QAAQ,SAAS;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,EAC9D,MAAM,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,GAClF,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,KAAK,OAAO,CAAC,IAAI,CAAC,CAerD;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,SAAS;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,EACrE,MAAM,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,GAC/E,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,KAAK,OAAO,CAAC,IAAI,CAAC,CAgCrD"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { createCredentialManager } from '../auth/credentials.js';
|
|
2
|
+
import { resolveOrg } from '../state/directory-config.js';
|
|
3
|
+
import { createCommandLogger } from './logger.js';
|
|
4
|
+
/**
|
|
5
|
+
* Wrapper for command actions that provides logging only (no auth).
|
|
6
|
+
* Requires `--session <id>` option on the command
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* .action(withLogging(async (options, { logger }) => {
|
|
10
|
+
* logger.info('Command started');
|
|
11
|
+
* // With data: logger.info({ userId: '123' }, 'User action');
|
|
12
|
+
* }))
|
|
13
|
+
*/
|
|
14
|
+
export function withLogging(action) {
|
|
15
|
+
return async function (options) {
|
|
16
|
+
const logger = createCommandLogger(this, {
|
|
17
|
+
sessionId: options.session,
|
|
18
|
+
context: { cwd: process.cwd() },
|
|
19
|
+
});
|
|
20
|
+
try {
|
|
21
|
+
return await action(options, { logger }, this);
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
const msg = error instanceof Error ? error.message : 'Unknown error';
|
|
25
|
+
logger.error({ error: msg }, 'Command failed');
|
|
26
|
+
throw error;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Wrapper for command actions that provides auth context and logging.
|
|
32
|
+
* Requires `--session <id>` option on the command.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* .action(withAuthAndLogging(async (options, { logger, accessToken, organization }) => {
|
|
36
|
+
* logger.info('Command started');
|
|
37
|
+
* // With data: logger.info({ orgId: organization.id }, 'Processing org');
|
|
38
|
+
* }))
|
|
39
|
+
*/
|
|
40
|
+
export function withAuthAndLogging(action) {
|
|
41
|
+
return async function (options) {
|
|
42
|
+
const logger = createCommandLogger(this, {
|
|
43
|
+
sessionId: options.session,
|
|
44
|
+
context: { cwd: process.cwd() },
|
|
45
|
+
});
|
|
46
|
+
try {
|
|
47
|
+
const credentialManager = await createCredentialManager();
|
|
48
|
+
const credentials = await credentialManager.getCredentials();
|
|
49
|
+
const resolvedOrg = resolveOrg(process.cwd());
|
|
50
|
+
if (!credentials || !resolvedOrg) {
|
|
51
|
+
console.log('No credentials for the straion cli found. Please log in first using "straion login".');
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
const ctx = {
|
|
55
|
+
logger,
|
|
56
|
+
accessToken: credentials?.accessToken,
|
|
57
|
+
organization: resolvedOrg,
|
|
58
|
+
};
|
|
59
|
+
return action(options, ctx, this);
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
const msg = error instanceof Error ? error.message : 'Unknown error';
|
|
63
|
+
logger.error({ error: msg }, 'Command failed');
|
|
64
|
+
throw error;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=middleware.js.map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AAM,uBAAuB,EAAE,CAAC;YAC1D,MAAM,WAAW,GAAG,MAAM,iBAAiB,CAAC,cAAc,EAAE,CAAC;YAC7D,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;YAE9C,IAAI,CAAC,WAAW,IAAI,CAAC,WAAW,EAAE,CAAC;gBACjC,OAAO,CAAC,GAAG,CACT,sFAAsF,CACvF,CAAC;gBACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;YAED,MAAM,GAAG,GAAgB;gBACvB,MAAM;gBACN,WAAW,EAAE,WAAW,EAAE,WAAW;gBACrC,YAAY,EAAE,WAAW;aAC1B,CAAC;YAEF,OAAO,MAAM,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;QACpC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,GAAG,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;YACrE,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,gBAAgB,CAAC,CAAC;YAC/C,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { OrganizationFragment } from '../lib/graphql.js';
|
|
2
|
+
export interface DirectoryOverride {
|
|
3
|
+
org: OrganizationFragment;
|
|
4
|
+
updatedAt: string;
|
|
5
|
+
}
|
|
6
|
+
export interface DirectoryOverrides {
|
|
7
|
+
[directoryPath: string]: DirectoryOverride;
|
|
8
|
+
}
|
|
9
|
+
export declare function getDirectoryOverrides(): DirectoryOverrides;
|
|
10
|
+
export declare function setDirectoryOrg(directory: string, org: OrganizationFragment): void;
|
|
11
|
+
export declare function getOrgForDirectory(directory: string): OrganizationFragment | null;
|
|
12
|
+
export declare function removeDirectoryOrg(directory: string): void;
|
|
13
|
+
/**
|
|
14
|
+
* Resolves the org for a directory using the following order:
|
|
15
|
+
* 1. Directory override (from directories.json)
|
|
16
|
+
* 2. Global default org (from config.json)
|
|
17
|
+
*
|
|
18
|
+
* Returns null if no org is configured.
|
|
19
|
+
*/
|
|
20
|
+
export declare function resolveOrg(directory: string): OrganizationFragment | null;
|
|
21
|
+
//# sourceMappingURL=directory-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directory-config.d.ts","sourceRoot":"","sources":["../../src/state/directory-config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAM9D,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,oBAAoB,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,CAAC,aAAa,EAAE,MAAM,GAAG,iBAAiB,CAAC;CAC5C;AAMD,wBAAgB,qBAAqB,IAAI,kBAAkB,CAa1D;AAQD,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,oBAAoB,GAAG,IAAI,CAOlF;AAED,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,oBAAoB,GAAG,IAAI,CAGjF;AAED,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAI1D;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,oBAAoB,GAAG,IAAI,CAQzE"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { ensureGlobalDir, getGlobalDir, globalConfig } from './global-config.js';
|
|
4
|
+
const DIRECTORIES_FILE = 'directories.json';
|
|
5
|
+
function getDirectoriesPath() {
|
|
6
|
+
return join(getGlobalDir(), DIRECTORIES_FILE);
|
|
7
|
+
}
|
|
8
|
+
export function getDirectoryOverrides() {
|
|
9
|
+
const filePath = getDirectoriesPath();
|
|
10
|
+
if (!existsSync(filePath)) {
|
|
11
|
+
return {};
|
|
12
|
+
}
|
|
13
|
+
try {
|
|
14
|
+
const content = readFileSync(filePath, 'utf8');
|
|
15
|
+
return JSON.parse(content);
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return {};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function saveDirectoryOverrides(overrides) {
|
|
22
|
+
ensureGlobalDir();
|
|
23
|
+
const filePath = getDirectoriesPath();
|
|
24
|
+
writeFileSync(filePath, JSON.stringify(overrides, null, 2), { mode: 0o600 });
|
|
25
|
+
}
|
|
26
|
+
export function setDirectoryOrg(directory, org) {
|
|
27
|
+
const overrides = getDirectoryOverrides();
|
|
28
|
+
overrides[directory] = {
|
|
29
|
+
org,
|
|
30
|
+
updatedAt: new Date().toISOString(),
|
|
31
|
+
};
|
|
32
|
+
saveDirectoryOverrides(overrides);
|
|
33
|
+
}
|
|
34
|
+
export function getOrgForDirectory(directory) {
|
|
35
|
+
const overrides = getDirectoryOverrides();
|
|
36
|
+
return overrides[directory]?.org ?? null;
|
|
37
|
+
}
|
|
38
|
+
export function removeDirectoryOrg(directory) {
|
|
39
|
+
const overrides = getDirectoryOverrides();
|
|
40
|
+
delete overrides[directory];
|
|
41
|
+
saveDirectoryOverrides(overrides);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Resolves the org for a directory using the following order:
|
|
45
|
+
* 1. Directory override (from directories.json)
|
|
46
|
+
* 2. Global default org (from config.json)
|
|
47
|
+
*
|
|
48
|
+
* Returns null if no org is configured.
|
|
49
|
+
*/
|
|
50
|
+
export function resolveOrg(directory) {
|
|
51
|
+
// First check directory-specific override
|
|
52
|
+
const directoryOrg = getOrgForDirectory(directory);
|
|
53
|
+
if (directoryOrg) {
|
|
54
|
+
return directoryOrg;
|
|
55
|
+
}
|
|
56
|
+
// Fall back to global default
|
|
57
|
+
return globalConfig.get().globalOrg;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=directory-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directory-config.js","sourceRoot":"","sources":["../../src/state/directory-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEjF,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;AAW5C,SAAS,kBAAkB;IACzB,OAAO,IAAI,CAAC,YAAY,EAAE,EAAE,gBAAgB,CAAC,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,qBAAqB;IACnC,MAAM,QAAQ,GAAG,kBAAkB,EAAE,CAAC;IAEtC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1B,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAC/C,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAuB,CAAC;IACnD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,SAAS,sBAAsB,CAAC,SAA6B;IAC3D,eAAe,EAAE,CAAC;IAClB,MAAM,QAAQ,GAAG,kBAAkB,EAAE,CAAC;IACtC,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;AAC/E,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,SAAiB,EAAE,GAAyB;IAC1E,MAAM,SAAS,GAAG,qBAAqB,EAAE,CAAC;IAC1C,SAAS,CAAC,SAAS,CAAC,GAAG;QACrB,GAAG;QACH,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KACpC,CAAC;IACF,sBAAsB,CAAC,SAAS,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,SAAiB;IAClD,MAAM,SAAS,GAAG,qBAAqB,EAAE,CAAC;IAC1C,OAAO,SAAS,CAAC,SAAS,CAAC,EAAE,GAAG,IAAI,IAAI,CAAC;AAC3C,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,SAAiB;IAClD,MAAM,SAAS,GAAG,qBAAqB,EAAE,CAAC;IAC1C,OAAO,SAAS,CAAC,SAAS,CAAC,CAAC;IAC5B,sBAAsB,CAAC,SAAS,CAAC,CAAC;AACpC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,SAAiB;IAC1C,0CAA0C;IAC1C,MAAM,YAAY,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC;IACnD,IAAI,YAAY,EAAE,CAAC;QACjB,OAAO,YAAY,CAAC;IACtB,CAAC;IACD,8BAA8B;IAC9B,OAAO,YAAY,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { OrganizationFragment } from '../lib/graphql.js';
|
|
2
|
+
export interface GlobalConfigState {
|
|
3
|
+
globalOrg: OrganizationFragment | null;
|
|
4
|
+
version: number;
|
|
5
|
+
}
|
|
6
|
+
export declare function getGlobalDir(): string;
|
|
7
|
+
export declare function ensureGlobalDir(): string;
|
|
8
|
+
declare function load(): GlobalConfigState;
|
|
9
|
+
export declare const globalConfig: {
|
|
10
|
+
get: typeof load;
|
|
11
|
+
setGlobalOrg(org: OrganizationFragment | null): void;
|
|
12
|
+
clear(): void;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=global-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global-config.d.ts","sourceRoot":"","sources":["../../src/state/global-config.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAM9D,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACvC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED,wBAAgB,eAAe,IAAI,MAAM,CAMxC;AAaD,iBAAS,IAAI,IAAI,iBAAiB,CAiBjC;AAQD,eAAO,MAAM,YAAY;;sBAGL,oBAAoB,GAAG,IAAI,GAAG,IAAI;aAM3C,IAAI;CAGd,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { homedir } from 'node:os';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
const STRAION_DIR = '.straion';
|
|
5
|
+
const CONFIG_FILE = 'config.json';
|
|
6
|
+
const CURRENT_VERSION = 1;
|
|
7
|
+
export function getGlobalDir() {
|
|
8
|
+
return join(homedir(), STRAION_DIR);
|
|
9
|
+
}
|
|
10
|
+
export function ensureGlobalDir() {
|
|
11
|
+
const dir = getGlobalDir();
|
|
12
|
+
if (!existsSync(dir)) {
|
|
13
|
+
mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
14
|
+
}
|
|
15
|
+
return dir;
|
|
16
|
+
}
|
|
17
|
+
function getConfigPath() {
|
|
18
|
+
return join(getGlobalDir(), CONFIG_FILE);
|
|
19
|
+
}
|
|
20
|
+
function getDefaultState() {
|
|
21
|
+
return {
|
|
22
|
+
globalOrg: null,
|
|
23
|
+
version: CURRENT_VERSION,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function load() {
|
|
27
|
+
const configPath = getConfigPath();
|
|
28
|
+
if (!existsSync(configPath)) {
|
|
29
|
+
return getDefaultState();
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
32
|
+
const content = readFileSync(configPath, 'utf8');
|
|
33
|
+
const config = JSON.parse(content);
|
|
34
|
+
return {
|
|
35
|
+
...getDefaultState(),
|
|
36
|
+
...config,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return getDefaultState();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function save(state) {
|
|
44
|
+
ensureGlobalDir();
|
|
45
|
+
const configPath = getConfigPath();
|
|
46
|
+
writeFileSync(configPath, JSON.stringify(state, null, 2), { mode: 0o600 });
|
|
47
|
+
}
|
|
48
|
+
export const globalConfig = {
|
|
49
|
+
get: load,
|
|
50
|
+
setGlobalOrg(org) {
|
|
51
|
+
const state = load();
|
|
52
|
+
state.globalOrg = org;
|
|
53
|
+
save(state);
|
|
54
|
+
},
|
|
55
|
+
clear() {
|
|
56
|
+
save(getDefaultState());
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=global-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global-config.js","sourceRoot":"","sources":["../../src/state/global-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC,MAAM,WAAW,GAAG,UAAU,CAAC;AAC/B,MAAM,WAAW,GAAG,aAAa,CAAC;AAClC,MAAM,eAAe,GAAG,CAAC,CAAC;AAO1B,MAAM,UAAU,YAAY;IAC1B,OAAO,IAAI,CAAC,OAAO,EAAE,EAAE,WAAW,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B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G,IAAI,EAAE,CAAC;QACrB,KAAK,CAAC,SAAS,GAAG,GAAG,CAAC;QACtB,IAAI,CAAC,KAAK,CAAC,CAAC;IACd,CAAC;IAED,KAAK;QACH,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;IAC1B,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface SessionEvent {
|
|
2
|
+
timestamp: string;
|
|
3
|
+
type: 'init' | 'command' | 'org-switch';
|
|
4
|
+
command?: string;
|
|
5
|
+
data?: Record<string, unknown>;
|
|
6
|
+
}
|
|
7
|
+
export interface Session {
|
|
8
|
+
id: string;
|
|
9
|
+
orgId: string;
|
|
10
|
+
directory: string;
|
|
11
|
+
createdAt: string;
|
|
12
|
+
updatedAt: string;
|
|
13
|
+
history: SessionEvent[];
|
|
14
|
+
}
|
|
15
|
+
export interface SessionSummary {
|
|
16
|
+
id: string;
|
|
17
|
+
orgId: string;
|
|
18
|
+
directory: string;
|
|
19
|
+
createdAt: string;
|
|
20
|
+
updatedAt: string;
|
|
21
|
+
eventCount: number;
|
|
22
|
+
}
|
|
23
|
+
export declare function getSession(sessionId: string): Session | null;
|
|
24
|
+
export declare function createSession(id: string, orgId: string, directory: string): Session;
|
|
25
|
+
export declare function getOrCreateSession(id: string, orgId: string, directory: string): {
|
|
26
|
+
session: Session;
|
|
27
|
+
created: boolean;
|
|
28
|
+
};
|
|
29
|
+
export declare function updateSessionOrg(sessionId: string, orgId: string): Session | null;
|
|
30
|
+
export declare function logSessionEvent(sessionId: string, type: SessionEvent['type'], command?: string, data?: Record<string, unknown>): Session | null;
|
|
31
|
+
export declare function deleteSession(sessionId: string): boolean;
|
|
32
|
+
export declare function listSessions(): Promise<SessionSummary[]>;
|
|
33
|
+
//# sourceMappingURL=session-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-manager.d.ts","sourceRoot":"","sources":["../../src/state/session-manager.ts"],"names":[],"mappings":"AAQA,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AAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,OAAO,GAAG,IAAI,CAiBhB;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAaxD;AAED,wBAAsB,YAAY,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAiC9D"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, unlinkSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { readdir } from 'node:fs/promises';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { ensureGlobalDir, getGlobalDir } from './global-config.js';
|
|
5
|
+
const SESSIONS_DIR = 'sessions';
|
|
6
|
+
function getSessionsDir() {
|
|
7
|
+
return join(getGlobalDir(), SESSIONS_DIR);
|
|
8
|
+
}
|
|
9
|
+
function ensureSessionsDir() {
|
|
10
|
+
ensureGlobalDir();
|
|
11
|
+
const dir = getSessionsDir();
|
|
12
|
+
if (!existsSync(dir)) {
|
|
13
|
+
mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
14
|
+
}
|
|
15
|
+
return dir;
|
|
16
|
+
}
|
|
17
|
+
function getSessionPath(sessionId) {
|
|
18
|
+
return join(getSessionsDir(), `${sessionId}.json`);
|
|
19
|
+
}
|
|
20
|
+
export function getSession(sessionId) {
|
|
21
|
+
const sessionPath = getSessionPath(sessionId);
|
|
22
|
+
if (!existsSync(sessionPath)) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
const content = readFileSync(sessionPath, 'utf8');
|
|
27
|
+
return JSON.parse(content);
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function saveSession(session) {
|
|
34
|
+
ensureSessionsDir();
|
|
35
|
+
const sessionPath = getSessionPath(session.id);
|
|
36
|
+
writeFileSync(sessionPath, JSON.stringify(session, null, 2), { mode: 0o600 });
|
|
37
|
+
}
|
|
38
|
+
export function createSession(id, orgId, directory) {
|
|
39
|
+
const now = new Date().toISOString();
|
|
40
|
+
const session = {
|
|
41
|
+
id,
|
|
42
|
+
orgId,
|
|
43
|
+
directory,
|
|
44
|
+
createdAt: now,
|
|
45
|
+
updatedAt: now,
|
|
46
|
+
history: [
|
|
47
|
+
{
|
|
48
|
+
timestamp: now,
|
|
49
|
+
type: 'init',
|
|
50
|
+
data: { orgId, directory },
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
};
|
|
54
|
+
saveSession(session);
|
|
55
|
+
return session;
|
|
56
|
+
}
|
|
57
|
+
export function getOrCreateSession(id, orgId, directory) {
|
|
58
|
+
const existing = getSession(id);
|
|
59
|
+
if (existing) {
|
|
60
|
+
return { session: existing, created: false };
|
|
61
|
+
}
|
|
62
|
+
const session = createSession(id, orgId, directory);
|
|
63
|
+
return { session, created: true };
|
|
64
|
+
}
|
|
65
|
+
export function updateSessionOrg(sessionId, orgId) {
|
|
66
|
+
const session = getSession(sessionId);
|
|
67
|
+
if (!session) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
const now = new Date().toISOString();
|
|
71
|
+
session.orgId = orgId;
|
|
72
|
+
session.updatedAt = now;
|
|
73
|
+
session.history.push({
|
|
74
|
+
timestamp: now,
|
|
75
|
+
type: 'org-switch',
|
|
76
|
+
data: { orgId },
|
|
77
|
+
});
|
|
78
|
+
saveSession(session);
|
|
79
|
+
return session;
|
|
80
|
+
}
|
|
81
|
+
export function logSessionEvent(sessionId, type, command, data) {
|
|
82
|
+
const session = getSession(sessionId);
|
|
83
|
+
if (!session) {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
const now = new Date().toISOString();
|
|
87
|
+
session.updatedAt = now;
|
|
88
|
+
session.history.push({
|
|
89
|
+
timestamp: now,
|
|
90
|
+
type,
|
|
91
|
+
command,
|
|
92
|
+
data,
|
|
93
|
+
});
|
|
94
|
+
saveSession(session);
|
|
95
|
+
return session;
|
|
96
|
+
}
|
|
97
|
+
export function deleteSession(sessionId) {
|
|
98
|
+
const sessionPath = getSessionPath(sessionId);
|
|
99
|
+
if (!existsSync(sessionPath)) {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
try {
|
|
103
|
+
unlinkSync(sessionPath);
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
export async function listSessions() {
|
|
111
|
+
const sessionsDir = getSessionsDir();
|
|
112
|
+
if (!existsSync(sessionsDir)) {
|
|
113
|
+
return [];
|
|
114
|
+
}
|
|
115
|
+
try {
|
|
116
|
+
const files = await readdir(sessionsDir);
|
|
117
|
+
const summaries = [];
|
|
118
|
+
for (const file of files) {
|
|
119
|
+
if (!file.endsWith('.json'))
|
|
120
|
+
continue;
|
|
121
|
+
const sessionId = file.replace('.json', '');
|
|
122
|
+
const session = getSession(sessionId);
|
|
123
|
+
if (session) {
|
|
124
|
+
summaries.push({
|
|
125
|
+
id: session.id,
|
|
126
|
+
orgId: session.orgId,
|
|
127
|
+
directory: session.directory,
|
|
128
|
+
createdAt: session.createdAt,
|
|
129
|
+
updatedAt: session.updatedAt,
|
|
130
|
+
eventCount: session.history.length,
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return summaries.sort((a, b) => b.updatedAt.localeCompare(a.updatedAt));
|
|
135
|
+
}
|
|
136
|
+
catch {
|
|
137
|
+
return [];
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=session-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-manager.js","sourceRoot":"","sources":["../../src/state/session-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACzF,OAAO,EAAE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C;IACZ,CAAC;IAED,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC;QACzC,MAAM,SAAS,GAAqB,EAAE,CAAC;QAEvC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;gBAAE,SAAS;YAEtC,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;YAC5C,MAAM,OAAO,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;YAEtC,IAAI,OAAO,EAAE,CAAC;gBACZ,SAAS,CAAC,IAAI,CAAC;oBACb,EAAE,EAAE,OAAO,CAAC,EAAE;oBACd,KAAK,EAAE,OAAO,CAAC,KAAK;oBACpB,SAAS,EAAE,OAAO,CAAC,SAAS;oBAC5B,SAAS,EAAE,OAAO,CAAC,SAAS;oBAC5B,SAAS,EAAE,OAAO,CAAC,SAAS;oBAC5B,UAAU,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM;iBACnC,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;IAC1E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@straion/cli",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"author": "Straion",
|
|
5
|
+
"bin": {
|
|
6
|
+
"straion": "./dist/cli.js"
|
|
7
|
+
},
|
|
8
|
+
"private": false,
|
|
9
|
+
"type": "module",
|
|
10
|
+
"license": "./LICENSE.txt",
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"commander": "^12.1.0",
|
|
13
|
+
"cookie": "^1.1.1",
|
|
14
|
+
"graphql": "^16.12.0",
|
|
15
|
+
"graphql-request": "^7.4.0",
|
|
16
|
+
"ink": "^6.6.0",
|
|
17
|
+
"ink-select-input": "^6.2.0",
|
|
18
|
+
"keytar": "^7.9.0",
|
|
19
|
+
"pino": "^10.2.1",
|
|
20
|
+
"react": "^19.0.0",
|
|
21
|
+
"terminal-link": "^5.0.0",
|
|
22
|
+
"zustand": "^4.5.5"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@types/node": "^22",
|
|
26
|
+
"@types/react": "^19.0.0",
|
|
27
|
+
"eslint": "^9",
|
|
28
|
+
"eslint-config-prettier": "^10",
|
|
29
|
+
"ink-testing-library": "^4.0.0",
|
|
30
|
+
"typescript": "^5.4.5",
|
|
31
|
+
"vitest": "^3.0.7"
|
|
32
|
+
},
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=22.0.0"
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"./dist",
|
|
38
|
+
"./LICENSE.txt",
|
|
39
|
+
"./README.md",
|
|
40
|
+
"./CHANGELOG.md"
|
|
41
|
+
],
|
|
42
|
+
"exports": "./dist/cli.js",
|
|
43
|
+
"types": "dist/cli.d.ts"
|
|
44
|
+
}
|