@knpkv/atlassian-common 1.6.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/cli-auth/AtlassianCliAuth.d.ts +8 -0
- package/dist/cli-auth/AtlassianCliAuth.d.ts.map +1 -1
- package/dist/cli-auth/AtlassianCliAuth.js.map +1 -1
- package/dist/cli-auth/authCommand.d.ts +43 -0
- package/dist/cli-auth/authCommand.d.ts.map +1 -0
- package/dist/cli-auth/authCommand.js +135 -0
- package/dist/cli-auth/authCommand.js.map +1 -0
- package/dist/cli-auth/index.d.ts +2 -1
- package/dist/cli-auth/index.d.ts.map +1 -1
- package/dist/cli-auth/index.js +1 -0
- package/dist/cli-auth/index.js.map +1 -1
- package/package.json +1 -1
- package/src/cli-auth/AtlassianCliAuth.ts +9 -0
- package/src/cli-auth/authCommand.ts +237 -0
- package/src/cli-auth/index.ts +8 -0
- package/test/ApiUpdateWorkflows.test.ts +78 -0
- package/test/cliAuth.authCommand.test.ts +161 -0
- package/test/cliAuth.login.test.ts +15 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @knpkv/atlassian-common
|
|
2
2
|
|
|
3
|
+
## 1.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#475](https://github.com/knpkv/npm/pull/475) [`08c62b7`](https://github.com/knpkv/npm/commit/08c62b787c649d8f78753515be6faf317791d62b) Thanks [@konopkov](https://github.com/konopkov)! - `auth use <profile>` and `auth remove <profile>` now fail with a typed `ProfileNotFoundError` (exported from `@knpkv/atlassian-common/cli-auth`) and exit non-zero when no stored profile matches. The failure names the profile (`Profile not found: <profile>`, on stderr through each CLI's error handler); previously the line went to stdout and the command exited 0, so a script could not tell a typo from a switch.
|
|
8
|
+
|
|
9
|
+
## 1.7.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#472](https://github.com/knpkv/npm/pull/472) [`d12c336`](https://github.com/knpkv/npm/commit/d12c3364e56abb7cfd32aa693c5406788a67e3f5) Thanks [@konopkov](https://github.com/konopkov)! - One shared `auth` command group for jira and confluence: `makeAuthCommand(service, descriptor, options)` in `@knpkv/atlassian-common/cli-auth`. Each CLI exports one descriptor (`jiraCliDescriptor`, `confluenceCliDescriptor`: command name, product name, login scopes) that feeds both its auth and its `auth` commands.
|
|
14
|
+
|
|
15
|
+
- `jira auth create` lists every scope `jira auth login` requests. It previously listed three of five (missing `write:jira-work` and `manage:jira-project`), so an app set up from its instructions could not log in.
|
|
16
|
+
- `jira auth manage` is new: it opens the developer console with the scope and callback checklist.
|
|
17
|
+
- `confluence auth profiles`, `auth use <profile>` and `auth remove <profile>` are new; the docs already described them.
|
|
18
|
+
- `confluence auth status` prints the active profile, account, site and profile ID.
|
|
19
|
+
- `auth create` and `auth manage` print the URL first and exit non-zero when no browser opens (jira's `create` used to ignore that).
|
|
20
|
+
|
|
3
21
|
## 1.6.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
|
@@ -55,6 +55,14 @@ export interface AccessibleSite {
|
|
|
55
55
|
readonly name: string;
|
|
56
56
|
readonly url: string;
|
|
57
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Who an Atlassian CLI is: the part of {@link AtlassianCliAuthOptions} its `auth` commands also read.
|
|
60
|
+
* A CLI defines it once and passes the same value to both, so the setup text lists exactly the
|
|
61
|
+
* scopes `login` requests.
|
|
62
|
+
*
|
|
63
|
+
* @category Types
|
|
64
|
+
*/
|
|
65
|
+
export type AtlassianCliDescriptor = Pick<AtlassianCliAuthOptions<never>, "commandName" | "productName" | "scopes">;
|
|
58
66
|
/**
|
|
59
67
|
* The auth operations an Atlassian CLI exposes.
|
|
60
68
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AtlassianCliAuth.d.ts","sourceRoot":"","sources":["../../src/cli-auth/Atl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AE,MAAM,CAAC,EAAE,CAAC,+BAA+B,CAAC,CAAC,GAAG,EAAE,CAC5D,YAAY,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,WAAW,CAAC,CAChF;QACD,aAAa,EAAE,MAAM,CAAC,EAAE,CAAC,gCAAgC,CAAC,CAAC,CAAC,QAAQ,EAAE,EAAE,CACtE,0BAA0B,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CACjE;QACD,aAAa,EAAE,MAAM,CAAC,EAAE,CAAC,gCAAgC,CAAC,CAAC,CAAC,QAAQ,EAAE,EAAE,CACtE,uBAAuB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAC9D;QACD,UAAU,EAAE,MAAM,CAAC,EAAE,CAAC,6BAA6B,CAAC,CAAC,GAAG,EAAE,CACxD,SAAS,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CACxD;KACF,CAAA;AACH,CAAC,CAAC,CACH,CAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `auth` command group every Atlassian CLI exposes, built once over its {@link AtlassianCliAuth}.
|
|
3
|
+
*
|
|
4
|
+
* **Mental model**
|
|
5
|
+
*
|
|
6
|
+
* - **One descriptor, two readers.** The CLI passes the same {@link AtlassianCliDescriptor} it built
|
|
7
|
+
* its auth from, so the setup instructions list exactly the scopes `auth login` requests. A second,
|
|
8
|
+
* hand-written list is how a setup that cannot log in happens: Atlassian rejects an authorization
|
|
9
|
+
* request naming a scope the app lacks.
|
|
10
|
+
* - **Only presentation is configured.** The heading the product's scopes sit under in the
|
|
11
|
+
* developer console, and what to call a site in `--site`.
|
|
12
|
+
* - **A browser that does not open is an error.** The URL is printed first, so a headless or SSH
|
|
13
|
+
* user can still finish by hand; the exit code just stops claiming it worked.
|
|
14
|
+
*
|
|
15
|
+
* @module
|
|
16
|
+
*/
|
|
17
|
+
import { Command, Prompt } from "effect/cli";
|
|
18
|
+
import type * as Context from "effect/Context";
|
|
19
|
+
import * as Schema from "effect/Schema";
|
|
20
|
+
import type { AtlassianCliAuth, AtlassianCliDescriptor } from "./AtlassianCliAuth.js";
|
|
21
|
+
/** The part of an Atlassian CLI's auth the `auth` commands drive. */
|
|
22
|
+
export type AuthCommandService = Pick<AtlassianCliAuth<never>, "configure" | "login" | "logout" | "getActiveProfile" | "listProfiles" | "switchProfile" | "removeProfile">;
|
|
23
|
+
/** What only the product decides about how its `auth` commands read. */
|
|
24
|
+
export interface AuthCommandOptions {
|
|
25
|
+
/** Developer-console heading the product's scopes live under, e.g. `"Jira API"`. */
|
|
26
|
+
readonly apiSection: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The scopes to enable on the OAuth app, by console section. `read:me` is a User Identity scope;
|
|
30
|
+
* `offline_access` is requested at authorize time but is not an app permission, so it is omitted.
|
|
31
|
+
*/
|
|
32
|
+
export declare const scopeInstructions: (descriptor: AtlassianCliDescriptor, apiSection: string) => string;
|
|
33
|
+
declare const ProfileNotFoundError_base: Schema.Class<ProfileNotFoundError, Schema.TaggedStruct<"ProfileNotFoundError", {
|
|
34
|
+
readonly selector: Schema.String;
|
|
35
|
+
readonly message: Schema.String;
|
|
36
|
+
}>, import("effect/Cause").YieldableError>;
|
|
37
|
+
/** `auth use` or `auth remove` named no stored profile. The CLI prints the message and exits non-zero. */
|
|
38
|
+
export declare class ProfileNotFoundError extends ProfileNotFoundError_base {
|
|
39
|
+
}
|
|
40
|
+
/** Build `<cli> auth` with create, manage, configure, login, logout, status, profiles, use, remove. */
|
|
41
|
+
export declare const makeAuthCommand: <I, S extends AuthCommandService>(service: Context.Key<I, S>, descriptor: AtlassianCliDescriptor, options: AuthCommandOptions) => Command.Command<"auth", {}, {}, import("./openBrowser.js").BrowserOpenError | import("../index.ts").OAuthError | ProfileNotFoundError | import("effect/Terminal").QuitError | (import("../index.ts").FileSystemError | import("../index.ts").HomeDirectoryError | import("effect/PlatformError").PlatformError), import("effect/process/ChildProcessSpawner").ChildProcessSpawner | Exclude<Exclude<I, "effect/cli/GlobalFlag/log-level">, Command.CommandContext<"auth">> | Prompt.Environment>;
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=authCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authCommand.d.ts","sourceRoot":"","sources":["../../src/cli-auth/authCommand.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAY,OAAO,EAAQ,MAAM,EAAE,MAAM,YAAY,CAAA;AAE5D,OAAO,KAAK,KAAK,OAAO,MAAM,gBAAgB,CAAA;AAG9C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAOrF,qEAAqE;AACrE,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACnC,gBAAgB,CAAC,KAAK,CAAC,EACrB,WAAW,GACX,OAAO,GACP,QAAQ,GACR,kBAAkB,GAClB,cAAc,GACd,eAAe,GACf,eAAe,CAClB,CAAA;AAED,wEAAwE;AACxE,MAAM,WAAW,kBAAkB;IACjC,oFAAoF;IACpF,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAC5B;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,eAAgB,sBAAsB,cAAc,MAAM,KAAG,MAQ1F,CAAA;;;;;AAED,0GAA0G;AAC1G,qBAAa,oBAAqB,SAAQ,yBAGxC;CAAG;AAQL,uGAAuG;AACvG,eAAO,MAAM,eAAe,GAAI,CAAC,EAAE,CAAC,SAAS,kBAAkB,WACpD,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,cACd,sBAAsB,WACzB,kBAAkB,qeA+J5B,CAAA"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `auth` command group every Atlassian CLI exposes, built once over its {@link AtlassianCliAuth}.
|
|
3
|
+
*
|
|
4
|
+
* **Mental model**
|
|
5
|
+
*
|
|
6
|
+
* - **One descriptor, two readers.** The CLI passes the same {@link AtlassianCliDescriptor} it built
|
|
7
|
+
* its auth from, so the setup instructions list exactly the scopes `auth login` requests. A second,
|
|
8
|
+
* hand-written list is how a setup that cannot log in happens: Atlassian rejects an authorization
|
|
9
|
+
* request naming a scope the app lacks.
|
|
10
|
+
* - **Only presentation is configured.** The heading the product's scopes sit under in the
|
|
11
|
+
* developer console, and what to call a site in `--site`.
|
|
12
|
+
* - **A browser that does not open is an error.** The URL is printed first, so a headless or SSH
|
|
13
|
+
* user can still finish by hand; the exit code just stops claiming it worked.
|
|
14
|
+
*
|
|
15
|
+
* @module
|
|
16
|
+
*/
|
|
17
|
+
import { Argument, Command, Flag, Prompt } from "effect/cli";
|
|
18
|
+
import * as Console from "effect/Console";
|
|
19
|
+
import * as Effect from "effect/Effect";
|
|
20
|
+
import * as Option from "effect/Option";
|
|
21
|
+
import * as Schema from "effect/Schema";
|
|
22
|
+
import { openBrowser } from "./openBrowser.js";
|
|
23
|
+
const CREATE_APP_URL = "https://developer.atlassian.com/console/myapps/create-3lo-app/";
|
|
24
|
+
const CONSOLE_APPS_URL = "https://developer.atlassian.com/console/myapps/";
|
|
25
|
+
const CALLBACK_URL = "http://localhost:8585/callback";
|
|
26
|
+
/**
|
|
27
|
+
* The scopes to enable on the OAuth app, by console section. `read:me` is a User Identity scope;
|
|
28
|
+
* `offline_access` is requested at authorize time but is not an app permission, so it is omitted.
|
|
29
|
+
*/
|
|
30
|
+
export const scopeInstructions = (descriptor, apiSection) => {
|
|
31
|
+
const section = (heading, scopes) => scopes.length === 0 ? [] : [` - ${heading}:`, ...scopes.map((scope) => ` ${scope}`)];
|
|
32
|
+
const permissions = descriptor.scopes.filter((scope) => scope !== "offline_access");
|
|
33
|
+
return [
|
|
34
|
+
...section(apiSection, permissions.filter((scope) => scope !== "read:me")),
|
|
35
|
+
...section("User Identity API", permissions.filter((scope) => scope === "read:me"))
|
|
36
|
+
].join("\n");
|
|
37
|
+
};
|
|
38
|
+
/** `auth use` or `auth remove` named no stored profile. The CLI prints the message and exits non-zero. */
|
|
39
|
+
export class ProfileNotFoundError extends Schema.TaggedError()("ProfileNotFoundError", {
|
|
40
|
+
selector: Schema.String,
|
|
41
|
+
message: Schema.String
|
|
42
|
+
}) {
|
|
43
|
+
}
|
|
44
|
+
const profileNotFound = (selector) => new ProfileNotFoundError({ selector, message: `Profile not found: ${selector}` });
|
|
45
|
+
/** Print the URL, then try to open it; a browser that never opened fails the command. */
|
|
46
|
+
const visit = (url) => Console.log(`Opening ${url}`).pipe(Effect.andThen(openBrowser(url)));
|
|
47
|
+
/** Build `<cli> auth` with create, manage, configure, login, logout, status, profiles, use, remove. */
|
|
48
|
+
export const makeAuthCommand = (service, descriptor, options) => {
|
|
49
|
+
const withAuth = (f) => Effect.flatMap(Effect.service(service), f);
|
|
50
|
+
const loginHint = `${descriptor.commandName} auth login`;
|
|
51
|
+
const create = Command.make("create", {}, () => Effect.gen(function* () {
|
|
52
|
+
yield* Console.log(`
|
|
53
|
+
Creating OAuth app in Atlassian Developer Console...
|
|
54
|
+
|
|
55
|
+
1. Browser will open to create a new OAuth 2.0 (3LO) app
|
|
56
|
+
2. Enter app name (e.g., "${descriptor.productName} CLI")
|
|
57
|
+
3. After creation, go to "Permissions" and add:
|
|
58
|
+
${scopeInstructions(descriptor, options.apiSection)}
|
|
59
|
+
4. Go to "Authorization" and set callback URL:
|
|
60
|
+
${CALLBACK_URL}
|
|
61
|
+
5. Go to "Settings" and copy Client ID and Secret
|
|
62
|
+
6. Run: ${descriptor.commandName} auth configure --client-id <ID> --client-secret <SECRET>
|
|
63
|
+
`);
|
|
64
|
+
yield* visit(CREATE_APP_URL);
|
|
65
|
+
})).pipe(Command.withDescription("Create OAuth app in Atlassian Developer Console"));
|
|
66
|
+
// Opens the app list, not the app: the console addresses an app by an id that is not the OAuth
|
|
67
|
+
// client id, and the client id is the only app identifier the CLI stores.
|
|
68
|
+
const manage = Command.make("manage", {}, () => Effect.gen(function* () {
|
|
69
|
+
yield* Console.log(`
|
|
70
|
+
Opening the Atlassian Developer Console app list...
|
|
71
|
+
|
|
72
|
+
Select your OAuth app, then under "Permissions" make sure every scope below is
|
|
73
|
+
enabled. \`${loginHint}\` requests all of them, and Atlassian rejects an
|
|
74
|
+
authorization request naming a scope the app does not have — so a missing scope
|
|
75
|
+
here fails the login itself, not just the command that needed it.
|
|
76
|
+
|
|
77
|
+
${scopeInstructions(descriptor, options.apiSection)}
|
|
78
|
+
|
|
79
|
+
Under "Authorization", the callback URL must be:
|
|
80
|
+
${CALLBACK_URL}
|
|
81
|
+
|
|
82
|
+
After adding scopes, run: ${loginHint}
|
|
83
|
+
`);
|
|
84
|
+
yield* visit(CONSOLE_APPS_URL);
|
|
85
|
+
})).pipe(Command.withDescription("Open the Atlassian Developer Console to edit the OAuth app's scopes"));
|
|
86
|
+
const configure = Command.make("configure", {
|
|
87
|
+
clientId: Flag.String("client-id").pipe(Flag.withDescription("OAuth client ID from Atlassian Developer Console"), Flag.optional),
|
|
88
|
+
clientSecret: Flag.String("client-secret").pipe(Flag.withDescription("OAuth client secret"), Flag.optional)
|
|
89
|
+
}, ({ clientId, clientSecret }) => withAuth((auth) => Effect.gen(function* () {
|
|
90
|
+
const id = Option.isSome(clientId)
|
|
91
|
+
? clientId.value
|
|
92
|
+
: yield* Prompt.String({ message: "Enter OAuth client ID:" });
|
|
93
|
+
const secret = Option.isSome(clientSecret)
|
|
94
|
+
? clientSecret.value
|
|
95
|
+
: yield* Prompt.String({ message: "Enter OAuth client secret:" });
|
|
96
|
+
yield* auth.configure({ clientId: id, clientSecret: secret });
|
|
97
|
+
yield* Console.log(`OAuth configured. Run '${loginHint}' to authenticate.`);
|
|
98
|
+
}))).pipe(Command.withDescription("Configure OAuth client credentials"));
|
|
99
|
+
const login = Command.make("login", {
|
|
100
|
+
site: Flag.String("site").pipe(Flag.withDescription(`${descriptor.productName} site URL to use (for accounts with multiple sites)`), Flag.optional)
|
|
101
|
+
}, ({ site }) => withAuth((auth) => Effect.gen(function* () {
|
|
102
|
+
const sites = yield* auth.login(Option.isSome(site) ? { siteUrl: site.value } : undefined);
|
|
103
|
+
if (Array.isArray(sites) && sites.length > 0) {
|
|
104
|
+
yield* Console.log("\nRe-run with --site to select a specific site.");
|
|
105
|
+
}
|
|
106
|
+
}))).pipe(Command.withDescription("Authenticate with Atlassian via OAuth"));
|
|
107
|
+
const logout = Command.make("logout", {}, () => withAuth((auth) => auth.logout().pipe(Effect.andThen(Console.log("Logged out"))))).pipe(Command.withDescription("Remove stored authentication"));
|
|
108
|
+
const status = Command.make("status", {}, () => withAuth((auth) => Effect.gen(function* () {
|
|
109
|
+
const profile = yield* auth.getActiveProfile();
|
|
110
|
+
if (profile === null) {
|
|
111
|
+
return yield* Console.log(`Not logged in. Use '${loginHint}' to authenticate.`);
|
|
112
|
+
}
|
|
113
|
+
const user = profile.token.user;
|
|
114
|
+
yield* Console.log(`Active profile: ${profile.name}`);
|
|
115
|
+
yield* Console.log(`Account: ${user !== undefined ? `${user.name} (${user.email})` : "unknown user"}`);
|
|
116
|
+
yield* Console.log(`Site: ${profile.token.site_url}`);
|
|
117
|
+
yield* Console.log(`Profile ID: ${profile.id}`);
|
|
118
|
+
}))).pipe(Command.withDescription("Show authentication status"));
|
|
119
|
+
const profiles = Command.make("profiles", {}, () => withAuth((auth) => Effect.gen(function* () {
|
|
120
|
+
const [stored, active] = yield* Effect.all([auth.listProfiles(), auth.getActiveProfile()]);
|
|
121
|
+
if (stored.length === 0) {
|
|
122
|
+
return yield* Console.log(`No auth profiles. Use '${loginHint}' to authenticate.`);
|
|
123
|
+
}
|
|
124
|
+
for (const profile of stored) {
|
|
125
|
+
yield* Console.log(`${active?.id === profile.id ? "*" : " "} ${profile.id}`);
|
|
126
|
+
yield* Console.log(` ${profile.name}`);
|
|
127
|
+
yield* Console.log(` ${profile.token.site_url}`);
|
|
128
|
+
}
|
|
129
|
+
}))).pipe(Command.withDescription("List stored auth profiles"));
|
|
130
|
+
const profile = Argument.String("profile").pipe(Argument.withDescription("Profile ID, name, site URL, cloud ID, or account ID"));
|
|
131
|
+
const use = Command.make("use", { profile }, ({ profile }) => withAuth((auth) => Effect.flatMap(auth.switchProfile(profile), (selected) => selected === null ? Effect.fail(profileNotFound(profile)) : Console.log(`Active profile: ${selected.name}`)))).pipe(Command.withDescription("Switch active auth profile"));
|
|
132
|
+
const remove = Command.make("remove", { profile }, ({ profile }) => withAuth((auth) => Effect.flatMap(auth.removeProfile(profile), (removed) => removed === null ? Effect.fail(profileNotFound(profile)) : Console.log(`Removed profile: ${removed.name}`)))).pipe(Command.withDescription("Remove stored auth profile"));
|
|
133
|
+
return Command.make("auth").pipe(Command.withDescription("Manage OAuth authentication"), Command.withSubcommands([create, manage, configure, login, logout, status, profiles, use, remove]));
|
|
134
|
+
};
|
|
135
|
+
//# sourceMappingURL=authCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authCommand.js","sourceRoot":"","sources":["../../src/cli-auth/authCommand.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAC5D,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AAEzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AA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GED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @module
|
|
8
8
|
*/
|
|
9
|
-
export { type AccessibleSite, type AtlassianCliAuth, type AtlassianCliAuthOptions, type LoginOptions, makeAtlassianCliAuth } from "./AtlassianCliAuth.js";
|
|
9
|
+
export { type AccessibleSite, type AtlassianCliAuth, type AtlassianCliAuthOptions, type AtlassianCliDescriptor, type LoginOptions, makeAtlassianCliAuth } from "./AtlassianCliAuth.js";
|
|
10
|
+
export { type AuthCommandOptions, type AuthCommandService, makeAuthCommand, ProfileNotFoundError, scopeInstructions } from "./authCommand.js";
|
|
10
11
|
export { HttpServerFactoryLive, NodeCliAuthLive } from "./internal/NodeLayers.js";
|
|
11
12
|
export { type HttpServerFactory, HttpServerFactoryTag, makeHttpServerFactory } from "./internal/oauthServer.js";
|
|
12
13
|
export { BrowserOpenError, openBrowser } from "./openBrowser.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli-auth/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,YAAY,EACjB,oBAAoB,EACrB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AACjF,OAAO,EAAE,KAAK,iBAAiB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAA;AAC/G,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli-auth/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,YAAY,EACjB,oBAAoB,EACrB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AACjF,OAAO,EAAE,KAAK,iBAAiB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAA;AAC/G,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA"}
|
package/dist/cli-auth/index.js
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* @module
|
|
8
8
|
*/
|
|
9
9
|
export { makeAtlassianCliAuth } from "./AtlassianCliAuth.js";
|
|
10
|
+
export { makeAuthCommand, ProfileNotFoundError, scopeInstructions } from "./authCommand.js";
|
|
10
11
|
export { HttpServerFactoryLive, NodeCliAuthLive } from "./internal/NodeLayers.js";
|
|
11
12
|
export { HttpServerFactoryTag, makeHttpServerFactory } from "./internal/oauthServer.js";
|
|
12
13
|
export { BrowserOpenError, openBrowser } from "./openBrowser.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli-auth/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli-auth/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAML,oBAAoB,EACrB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAGL,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AACjF,OAAO,EAA0B,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAA;AAC/G,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA"}
|
package/package.json
CHANGED
|
@@ -115,6 +115,15 @@ export interface AccessibleSite {
|
|
|
115
115
|
readonly url: string
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
+
/**
|
|
119
|
+
* Who an Atlassian CLI is: the part of {@link AtlassianCliAuthOptions} its `auth` commands also read.
|
|
120
|
+
* A CLI defines it once and passes the same value to both, so the setup text lists exactly the
|
|
121
|
+
* scopes `login` requests.
|
|
122
|
+
*
|
|
123
|
+
* @category Types
|
|
124
|
+
*/
|
|
125
|
+
export type AtlassianCliDescriptor = Pick<AtlassianCliAuthOptions<never>, "commandName" | "productName" | "scopes">
|
|
126
|
+
|
|
118
127
|
/**
|
|
119
128
|
* The auth operations an Atlassian CLI exposes.
|
|
120
129
|
*
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `auth` command group every Atlassian CLI exposes, built once over its {@link AtlassianCliAuth}.
|
|
3
|
+
*
|
|
4
|
+
* **Mental model**
|
|
5
|
+
*
|
|
6
|
+
* - **One descriptor, two readers.** The CLI passes the same {@link AtlassianCliDescriptor} it built
|
|
7
|
+
* its auth from, so the setup instructions list exactly the scopes `auth login` requests. A second,
|
|
8
|
+
* hand-written list is how a setup that cannot log in happens: Atlassian rejects an authorization
|
|
9
|
+
* request naming a scope the app lacks.
|
|
10
|
+
* - **Only presentation is configured.** The heading the product's scopes sit under in the
|
|
11
|
+
* developer console, and what to call a site in `--site`.
|
|
12
|
+
* - **A browser that does not open is an error.** The URL is printed first, so a headless or SSH
|
|
13
|
+
* user can still finish by hand; the exit code just stops claiming it worked.
|
|
14
|
+
*
|
|
15
|
+
* @module
|
|
16
|
+
*/
|
|
17
|
+
import { Argument, Command, Flag, Prompt } from "effect/cli"
|
|
18
|
+
import * as Console from "effect/Console"
|
|
19
|
+
import type * as Context from "effect/Context"
|
|
20
|
+
import * as Effect from "effect/Effect"
|
|
21
|
+
import * as Option from "effect/Option"
|
|
22
|
+
import * as Schema from "effect/Schema"
|
|
23
|
+
import type { AtlassianCliAuth, AtlassianCliDescriptor } from "./AtlassianCliAuth.js"
|
|
24
|
+
import { openBrowser } from "./openBrowser.js"
|
|
25
|
+
|
|
26
|
+
const CREATE_APP_URL = "https://developer.atlassian.com/console/myapps/create-3lo-app/"
|
|
27
|
+
const CONSOLE_APPS_URL = "https://developer.atlassian.com/console/myapps/"
|
|
28
|
+
const CALLBACK_URL = "http://localhost:8585/callback"
|
|
29
|
+
|
|
30
|
+
/** The part of an Atlassian CLI's auth the `auth` commands drive. */
|
|
31
|
+
export type AuthCommandService = Pick<
|
|
32
|
+
AtlassianCliAuth<never>,
|
|
33
|
+
| "configure"
|
|
34
|
+
| "login"
|
|
35
|
+
| "logout"
|
|
36
|
+
| "getActiveProfile"
|
|
37
|
+
| "listProfiles"
|
|
38
|
+
| "switchProfile"
|
|
39
|
+
| "removeProfile"
|
|
40
|
+
>
|
|
41
|
+
|
|
42
|
+
/** What only the product decides about how its `auth` commands read. */
|
|
43
|
+
export interface AuthCommandOptions {
|
|
44
|
+
/** Developer-console heading the product's scopes live under, e.g. `"Jira API"`. */
|
|
45
|
+
readonly apiSection: string
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The scopes to enable on the OAuth app, by console section. `read:me` is a User Identity scope;
|
|
50
|
+
* `offline_access` is requested at authorize time but is not an app permission, so it is omitted.
|
|
51
|
+
*/
|
|
52
|
+
export const scopeInstructions = (descriptor: AtlassianCliDescriptor, apiSection: string): string => {
|
|
53
|
+
const section = (heading: string, scopes: ReadonlyArray<string>): ReadonlyArray<string> =>
|
|
54
|
+
scopes.length === 0 ? [] : [` - ${heading}:`, ...scopes.map((scope) => ` ${scope}`)]
|
|
55
|
+
const permissions = descriptor.scopes.filter((scope) => scope !== "offline_access")
|
|
56
|
+
return [
|
|
57
|
+
...section(apiSection, permissions.filter((scope) => scope !== "read:me")),
|
|
58
|
+
...section("User Identity API", permissions.filter((scope) => scope === "read:me"))
|
|
59
|
+
].join("\n")
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** `auth use` or `auth remove` named no stored profile. The CLI prints the message and exits non-zero. */
|
|
63
|
+
export class ProfileNotFoundError extends Schema.TaggedError<ProfileNotFoundError>()("ProfileNotFoundError", {
|
|
64
|
+
selector: Schema.String,
|
|
65
|
+
message: Schema.String
|
|
66
|
+
}) {}
|
|
67
|
+
|
|
68
|
+
const profileNotFound = (selector: string) =>
|
|
69
|
+
new ProfileNotFoundError({ selector, message: `Profile not found: ${selector}` })
|
|
70
|
+
|
|
71
|
+
/** Print the URL, then try to open it; a browser that never opened fails the command. */
|
|
72
|
+
const visit = (url: string) => Console.log(`Opening ${url}`).pipe(Effect.andThen(openBrowser(url)))
|
|
73
|
+
|
|
74
|
+
/** Build `<cli> auth` with create, manage, configure, login, logout, status, profiles, use, remove. */
|
|
75
|
+
export const makeAuthCommand = <I, S extends AuthCommandService>(
|
|
76
|
+
service: Context.Key<I, S>,
|
|
77
|
+
descriptor: AtlassianCliDescriptor,
|
|
78
|
+
options: AuthCommandOptions
|
|
79
|
+
) => {
|
|
80
|
+
const withAuth = <A, Err, R>(f: (auth: S) => Effect.Effect<A, Err, R>) => Effect.flatMap(Effect.service(service), f)
|
|
81
|
+
const loginHint = `${descriptor.commandName} auth login`
|
|
82
|
+
|
|
83
|
+
const create = Command.make("create", {}, () =>
|
|
84
|
+
Effect.gen(function*() {
|
|
85
|
+
yield* Console.log(`
|
|
86
|
+
Creating OAuth app in Atlassian Developer Console...
|
|
87
|
+
|
|
88
|
+
1. Browser will open to create a new OAuth 2.0 (3LO) app
|
|
89
|
+
2. Enter app name (e.g., "${descriptor.productName} CLI")
|
|
90
|
+
3. After creation, go to "Permissions" and add:
|
|
91
|
+
${scopeInstructions(descriptor, options.apiSection)}
|
|
92
|
+
4. Go to "Authorization" and set callback URL:
|
|
93
|
+
${CALLBACK_URL}
|
|
94
|
+
5. Go to "Settings" and copy Client ID and Secret
|
|
95
|
+
6. Run: ${descriptor.commandName} auth configure --client-id <ID> --client-secret <SECRET>
|
|
96
|
+
`)
|
|
97
|
+
yield* visit(CREATE_APP_URL)
|
|
98
|
+
})).pipe(Command.withDescription("Create OAuth app in Atlassian Developer Console"))
|
|
99
|
+
|
|
100
|
+
// Opens the app list, not the app: the console addresses an app by an id that is not the OAuth
|
|
101
|
+
// client id, and the client id is the only app identifier the CLI stores.
|
|
102
|
+
const manage = Command.make("manage", {}, () =>
|
|
103
|
+
Effect.gen(function*() {
|
|
104
|
+
yield* Console.log(`
|
|
105
|
+
Opening the Atlassian Developer Console app list...
|
|
106
|
+
|
|
107
|
+
Select your OAuth app, then under "Permissions" make sure every scope below is
|
|
108
|
+
enabled. \`${loginHint}\` requests all of them, and Atlassian rejects an
|
|
109
|
+
authorization request naming a scope the app does not have — so a missing scope
|
|
110
|
+
here fails the login itself, not just the command that needed it.
|
|
111
|
+
|
|
112
|
+
${scopeInstructions(descriptor, options.apiSection)}
|
|
113
|
+
|
|
114
|
+
Under "Authorization", the callback URL must be:
|
|
115
|
+
${CALLBACK_URL}
|
|
116
|
+
|
|
117
|
+
After adding scopes, run: ${loginHint}
|
|
118
|
+
`)
|
|
119
|
+
yield* visit(CONSOLE_APPS_URL)
|
|
120
|
+
})).pipe(Command.withDescription("Open the Atlassian Developer Console to edit the OAuth app's scopes"))
|
|
121
|
+
|
|
122
|
+
const configure = Command.make(
|
|
123
|
+
"configure",
|
|
124
|
+
{
|
|
125
|
+
clientId: Flag.String("client-id").pipe(
|
|
126
|
+
Flag.withDescription("OAuth client ID from Atlassian Developer Console"),
|
|
127
|
+
Flag.optional
|
|
128
|
+
),
|
|
129
|
+
clientSecret: Flag.String("client-secret").pipe(Flag.withDescription("OAuth client secret"), Flag.optional)
|
|
130
|
+
},
|
|
131
|
+
({ clientId, clientSecret }) =>
|
|
132
|
+
withAuth((auth) =>
|
|
133
|
+
Effect.gen(function*() {
|
|
134
|
+
const id = Option.isSome(clientId)
|
|
135
|
+
? clientId.value
|
|
136
|
+
: yield* Prompt.String({ message: "Enter OAuth client ID:" })
|
|
137
|
+
const secret = Option.isSome(clientSecret)
|
|
138
|
+
? clientSecret.value
|
|
139
|
+
: yield* Prompt.String({ message: "Enter OAuth client secret:" })
|
|
140
|
+
yield* auth.configure({ clientId: id, clientSecret: secret })
|
|
141
|
+
yield* Console.log(`OAuth configured. Run '${loginHint}' to authenticate.`)
|
|
142
|
+
})
|
|
143
|
+
)
|
|
144
|
+
).pipe(Command.withDescription("Configure OAuth client credentials"))
|
|
145
|
+
|
|
146
|
+
const login = Command.make(
|
|
147
|
+
"login",
|
|
148
|
+
{
|
|
149
|
+
site: Flag.String("site").pipe(
|
|
150
|
+
Flag.withDescription(`${descriptor.productName} site URL to use (for accounts with multiple sites)`),
|
|
151
|
+
Flag.optional
|
|
152
|
+
)
|
|
153
|
+
},
|
|
154
|
+
({ site }) =>
|
|
155
|
+
withAuth((auth) =>
|
|
156
|
+
Effect.gen(function*() {
|
|
157
|
+
const sites = yield* auth.login(Option.isSome(site) ? { siteUrl: site.value } : undefined)
|
|
158
|
+
if (Array.isArray(sites) && sites.length > 0) {
|
|
159
|
+
yield* Console.log("\nRe-run with --site to select a specific site.")
|
|
160
|
+
}
|
|
161
|
+
})
|
|
162
|
+
)
|
|
163
|
+
).pipe(Command.withDescription("Authenticate with Atlassian via OAuth"))
|
|
164
|
+
|
|
165
|
+
const logout = Command.make(
|
|
166
|
+
"logout",
|
|
167
|
+
{},
|
|
168
|
+
() => withAuth((auth) => auth.logout().pipe(Effect.andThen(Console.log("Logged out"))))
|
|
169
|
+
).pipe(
|
|
170
|
+
Command.withDescription("Remove stored authentication")
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
const status = Command.make("status", {}, () =>
|
|
174
|
+
withAuth((auth) =>
|
|
175
|
+
Effect.gen(function*() {
|
|
176
|
+
const profile = yield* auth.getActiveProfile()
|
|
177
|
+
if (profile === null) {
|
|
178
|
+
return yield* Console.log(`Not logged in. Use '${loginHint}' to authenticate.`)
|
|
179
|
+
}
|
|
180
|
+
const user = profile.token.user
|
|
181
|
+
yield* Console.log(`Active profile: ${profile.name}`)
|
|
182
|
+
yield* Console.log(`Account: ${user !== undefined ? `${user.name} (${user.email})` : "unknown user"}`)
|
|
183
|
+
yield* Console.log(`Site: ${profile.token.site_url}`)
|
|
184
|
+
yield* Console.log(`Profile ID: ${profile.id}`)
|
|
185
|
+
})
|
|
186
|
+
)).pipe(Command.withDescription("Show authentication status"))
|
|
187
|
+
|
|
188
|
+
const profiles = Command.make("profiles", {}, () =>
|
|
189
|
+
withAuth((auth) =>
|
|
190
|
+
Effect.gen(function*() {
|
|
191
|
+
const [stored, active] = yield* Effect.all([auth.listProfiles(), auth.getActiveProfile()])
|
|
192
|
+
if (stored.length === 0) {
|
|
193
|
+
return yield* Console.log(`No auth profiles. Use '${loginHint}' to authenticate.`)
|
|
194
|
+
}
|
|
195
|
+
for (const profile of stored) {
|
|
196
|
+
yield* Console.log(`${active?.id === profile.id ? "*" : " "} ${profile.id}`)
|
|
197
|
+
yield* Console.log(` ${profile.name}`)
|
|
198
|
+
yield* Console.log(` ${profile.token.site_url}`)
|
|
199
|
+
}
|
|
200
|
+
})
|
|
201
|
+
)).pipe(Command.withDescription("List stored auth profiles"))
|
|
202
|
+
|
|
203
|
+
const profile = Argument.String("profile").pipe(
|
|
204
|
+
Argument.withDescription("Profile ID, name, site URL, cloud ID, or account ID")
|
|
205
|
+
)
|
|
206
|
+
|
|
207
|
+
const use = Command.make(
|
|
208
|
+
"use",
|
|
209
|
+
{ profile },
|
|
210
|
+
({ profile }) =>
|
|
211
|
+
withAuth((auth) =>
|
|
212
|
+
Effect.flatMap(
|
|
213
|
+
auth.switchProfile(profile),
|
|
214
|
+
(selected) =>
|
|
215
|
+
selected === null ? Effect.fail(profileNotFound(profile)) : Console.log(`Active profile: ${selected.name}`)
|
|
216
|
+
)
|
|
217
|
+
)
|
|
218
|
+
).pipe(Command.withDescription("Switch active auth profile"))
|
|
219
|
+
|
|
220
|
+
const remove = Command.make(
|
|
221
|
+
"remove",
|
|
222
|
+
{ profile },
|
|
223
|
+
({ profile }) =>
|
|
224
|
+
withAuth((auth) =>
|
|
225
|
+
Effect.flatMap(
|
|
226
|
+
auth.removeProfile(profile),
|
|
227
|
+
(removed) =>
|
|
228
|
+
removed === null ? Effect.fail(profileNotFound(profile)) : Console.log(`Removed profile: ${removed.name}`)
|
|
229
|
+
)
|
|
230
|
+
)
|
|
231
|
+
).pipe(Command.withDescription("Remove stored auth profile"))
|
|
232
|
+
|
|
233
|
+
return Command.make("auth").pipe(
|
|
234
|
+
Command.withDescription("Manage OAuth authentication"),
|
|
235
|
+
Command.withSubcommands([create, manage, configure, login, logout, status, profiles, use, remove])
|
|
236
|
+
)
|
|
237
|
+
}
|
package/src/cli-auth/index.ts
CHANGED
|
@@ -10,9 +10,17 @@ export {
|
|
|
10
10
|
type AccessibleSite,
|
|
11
11
|
type AtlassianCliAuth,
|
|
12
12
|
type AtlassianCliAuthOptions,
|
|
13
|
+
type AtlassianCliDescriptor,
|
|
13
14
|
type LoginOptions,
|
|
14
15
|
makeAtlassianCliAuth
|
|
15
16
|
} from "./AtlassianCliAuth.js"
|
|
17
|
+
export {
|
|
18
|
+
type AuthCommandOptions,
|
|
19
|
+
type AuthCommandService,
|
|
20
|
+
makeAuthCommand,
|
|
21
|
+
ProfileNotFoundError,
|
|
22
|
+
scopeInstructions
|
|
23
|
+
} from "./authCommand.js"
|
|
16
24
|
export { HttpServerFactoryLive, NodeCliAuthLive } from "./internal/NodeLayers.js"
|
|
17
25
|
export { type HttpServerFactory, HttpServerFactoryTag, makeHttpServerFactory } from "./internal/oauthServer.js"
|
|
18
26
|
export { BrowserOpenError, openBrowser } from "./openBrowser.js"
|
|
@@ -107,6 +107,40 @@ const changesetPathDiagnostics = (source: string): ReadonlyArray<string> =>
|
|
|
107
107
|
: [`Generated changeset ${changesetPath ?? ""} must be unique per workflow run`]
|
|
108
108
|
)
|
|
109
109
|
|
|
110
|
+
// A regenerated-client-only diff is generator churn, not an upstream change: the
|
|
111
|
+
// detection step must compare only the workflow's own client `specsDir`, and the
|
|
112
|
+
// pull request must be gated on it.
|
|
113
|
+
const specOnlyGuardDiagnostics = (source: string, specsDir: string): ReadonlyArray<string> => {
|
|
114
|
+
const workflow: unknown = parse(source)
|
|
115
|
+
if (!isRecord(workflow) || !isRecord(workflow.jobs)) return ["API update workflow could not be inspected"]
|
|
116
|
+
|
|
117
|
+
return Object.values(workflow.jobs).flatMap((job) => {
|
|
118
|
+
if (!isRecord(job) || !Array.isArray(job.steps)) return []
|
|
119
|
+
const steps = job.steps.filter(isRecord)
|
|
120
|
+
const detection = steps.find((step) => Predicate.isString(step.run) && step.run.includes("updated=true"))
|
|
121
|
+
if (detection === undefined || !Predicate.isString(detection.id) || !Predicate.isString(detection.run)) {
|
|
122
|
+
return ["API update workflow must detect upstream spec changes"]
|
|
123
|
+
}
|
|
124
|
+
const pathspecs = detection.run.replace(/\\\n\s*/gu, " ").match(/git diff --quiet -- ([^;\n]+)/u)?.[1]
|
|
125
|
+
?.trim().split(/\s+/u) ?? []
|
|
126
|
+
const pathspecDiagnostics = pathspecs.length === 0
|
|
127
|
+
? ["API update workflow must compare spec paths with git diff --quiet"]
|
|
128
|
+
: pathspecs.flatMap((pathspec) =>
|
|
129
|
+
pathspec === specsDir || pathspec.startsWith(`${specsDir}/`)
|
|
130
|
+
? []
|
|
131
|
+
: [`API update workflow must open a pull request only for spec changes, not ${pathspec}`]
|
|
132
|
+
)
|
|
133
|
+
const gate = `steps.${detection.id}.outputs.updated == 'true'`
|
|
134
|
+
const pullRequestDiagnostics = steps.flatMap((step) =>
|
|
135
|
+
Predicate.isString(step.uses) && step.uses.startsWith("peter-evans/create-pull-request@")
|
|
136
|
+
&& !(Predicate.isString(step.if) && step.if.includes(gate))
|
|
137
|
+
? ["API update pull request must be gated on the spec-change detection step"]
|
|
138
|
+
: []
|
|
139
|
+
)
|
|
140
|
+
return [...pathspecDiagnostics, ...pullRequestDiagnostics]
|
|
141
|
+
})
|
|
142
|
+
}
|
|
143
|
+
|
|
110
144
|
const releaseWorkflow = (name: string, release: string, guidance = "Review the generated API.") => `
|
|
111
145
|
jobs:
|
|
112
146
|
update:
|
|
@@ -321,6 +355,50 @@ jobs:
|
|
|
321
355
|
}
|
|
322
356
|
}))
|
|
323
357
|
|
|
358
|
+
it("rejects generated-code detection and accepts a spec-only gate", () => {
|
|
359
|
+
const workflow = (pathspecs: string, gate: string) => `
|
|
360
|
+
jobs:
|
|
361
|
+
update:
|
|
362
|
+
steps:
|
|
363
|
+
- name: Detect spec changes
|
|
364
|
+
id: check
|
|
365
|
+
run: |
|
|
366
|
+
if git diff --quiet -- \\
|
|
367
|
+
${pathspecs}; then
|
|
368
|
+
echo "updated=false" >> "$GITHUB_OUTPUT"
|
|
369
|
+
else
|
|
370
|
+
echo "updated=true" >> "$GITHUB_OUTPUT"
|
|
371
|
+
fi
|
|
372
|
+
- name: Create pull request
|
|
373
|
+
if: ${gate}
|
|
374
|
+
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1
|
|
375
|
+
`
|
|
376
|
+
const gate = "steps.check.outputs.updated == 'true'"
|
|
377
|
+
const specs = "packages/x/.specs"
|
|
378
|
+
expect(specOnlyGuardDiagnostics(workflow("packages/x/.specs packages/x/src/generated", gate), specs)).toEqual([
|
|
379
|
+
"API update workflow must open a pull request only for spec changes, not packages/x/src/generated"
|
|
380
|
+
])
|
|
381
|
+
expect(specOnlyGuardDiagnostics(workflow("packages/y/.specs", gate), specs)).toEqual([
|
|
382
|
+
"API update workflow must open a pull request only for spec changes, not packages/y/.specs"
|
|
383
|
+
])
|
|
384
|
+
expect(specOnlyGuardDiagnostics(workflow("packages/x/.specs-old", gate), specs)).toEqual([
|
|
385
|
+
"API update workflow must open a pull request only for spec changes, not packages/x/.specs-old"
|
|
386
|
+
])
|
|
387
|
+
expect(specOnlyGuardDiagnostics(workflow("packages/x/.specs", "always()"), specs)).toEqual([
|
|
388
|
+
"API update pull request must be gated on the spec-change detection step"
|
|
389
|
+
])
|
|
390
|
+
expect(specOnlyGuardDiagnostics(workflow("packages/x/.specs/x-v1.json", gate), specs)).toEqual([])
|
|
391
|
+
expect(specOnlyGuardDiagnostics(workflow("packages/x/.specs", gate), specs)).toEqual([])
|
|
392
|
+
})
|
|
393
|
+
|
|
394
|
+
it.effect("opens API update pull requests only for spec changes", () =>
|
|
395
|
+
Effect.gen(function*() {
|
|
396
|
+
for (const client of ["clockify", "jira", "confluence"]) {
|
|
397
|
+
const source = yield* loadWorkflow(`${client}-api-update.yml`)
|
|
398
|
+
expect(specOnlyGuardDiagnostics(source, `packages/${client}-api-client/.specs`)).toEqual([])
|
|
399
|
+
}
|
|
400
|
+
}))
|
|
401
|
+
|
|
324
402
|
it("rejects a bare consumer build and accepts a dependency-closed build", () => {
|
|
325
403
|
const invalid = `
|
|
326
404
|
jobs:
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/** @effect-diagnostics strictEffectProvide:skip-file */
|
|
2
|
+
/**
|
|
3
|
+
* The shared `auth` command group: its setup text lists exactly the scopes the service logs in
|
|
4
|
+
* with, a browser that never opens fails the command after the URL is printed, and the profile
|
|
5
|
+
* commands read the same store for every product.
|
|
6
|
+
*/
|
|
7
|
+
import { NodeServices } from "@effect/platform-node"
|
|
8
|
+
import { describe, expect, it } from "@effect/vitest"
|
|
9
|
+
import * as Cause from "effect/Cause"
|
|
10
|
+
import { Command } from "effect/cli"
|
|
11
|
+
import * as Console from "effect/Console"
|
|
12
|
+
import * as Context from "effect/Context"
|
|
13
|
+
import * as Effect from "effect/Effect"
|
|
14
|
+
import * as Exit from "effect/Exit"
|
|
15
|
+
import * as Layer from "effect/Layer"
|
|
16
|
+
import * as PlatformError from "effect/PlatformError"
|
|
17
|
+
import { ChildProcessSpawner } from "effect/process"
|
|
18
|
+
import * as Sink from "effect/Sink"
|
|
19
|
+
import * as Stream from "effect/Stream"
|
|
20
|
+
import { type AuthCommandService, makeAuthCommand, scopeInstructions } from "../src/cli-auth/index.js"
|
|
21
|
+
import type { AuthProfile } from "../src/config/index.js"
|
|
22
|
+
|
|
23
|
+
class TestAuth extends Context.Service<TestAuth, AuthCommandService>()("test/TestAuth") {}
|
|
24
|
+
|
|
25
|
+
const SCOPES = [
|
|
26
|
+
"read:jira-work",
|
|
27
|
+
"write:jira-work",
|
|
28
|
+
"manage:jira-project",
|
|
29
|
+
"read:jira-user",
|
|
30
|
+
"read:me",
|
|
31
|
+
"offline_access"
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
const descriptor = { commandName: "jira", productName: "Jira", scopes: SCOPES }
|
|
35
|
+
|
|
36
|
+
const profile: AuthProfile = {
|
|
37
|
+
id: "cloud-1:account-1",
|
|
38
|
+
name: "User 1 @ site-1",
|
|
39
|
+
token: {
|
|
40
|
+
access_token: "access-1",
|
|
41
|
+
refresh_token: "refresh-1",
|
|
42
|
+
expires_at: 0,
|
|
43
|
+
scope: "read:me",
|
|
44
|
+
cloud_id: "cloud-1",
|
|
45
|
+
site_url: "https://site-1.atlassian.net",
|
|
46
|
+
user: { account_id: "account-1", name: "User 1", email: "user-1@example.com" }
|
|
47
|
+
},
|
|
48
|
+
created_at: "2026-10-05T00:00:00.000Z",
|
|
49
|
+
updated_at: "2026-10-05T00:00:00.000Z"
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const fakeAuth = (active: AuthProfile | null): AuthCommandService => ({
|
|
53
|
+
configure: () => Effect.void,
|
|
54
|
+
login: () => Effect.void,
|
|
55
|
+
logout: () => Effect.void,
|
|
56
|
+
getActiveProfile: () => Effect.succeed(active),
|
|
57
|
+
listProfiles: () => Effect.succeed(active === null ? [] : [active]),
|
|
58
|
+
switchProfile: () => Effect.succeed(null),
|
|
59
|
+
removeProfile: () => Effect.succeed(null)
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
// `opens` decides whether `open` exits 0; every other launcher is missing.
|
|
63
|
+
const launchers = (opens: boolean) =>
|
|
64
|
+
Layer.succeed(
|
|
65
|
+
ChildProcessSpawner.ChildProcessSpawner,
|
|
66
|
+
ChildProcessSpawner.make((command) =>
|
|
67
|
+
command._tag === "StandardCommand" && command.command === "open"
|
|
68
|
+
? Effect.succeed(ChildProcessSpawner.makeHandle({
|
|
69
|
+
all: Stream.empty,
|
|
70
|
+
exitCode: Effect.succeed(ChildProcessSpawner.ExitCode(opens ? 0 : 1)),
|
|
71
|
+
getInputFd: () => Sink.drain,
|
|
72
|
+
getOutputFd: () => Stream.empty,
|
|
73
|
+
isRunning: Effect.succeed(false),
|
|
74
|
+
kill: () => Effect.void,
|
|
75
|
+
pid: ChildProcessSpawner.ProcessId(1),
|
|
76
|
+
reref: Effect.void,
|
|
77
|
+
stderr: Stream.empty,
|
|
78
|
+
stdin: Sink.drain,
|
|
79
|
+
stdout: Stream.empty,
|
|
80
|
+
unref: Effect.succeed(Effect.void)
|
|
81
|
+
}))
|
|
82
|
+
: Effect.fail(PlatformError.systemError({ _tag: "NotFound", module: "ChildProcess", method: "spawn" }))
|
|
83
|
+
)
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
const run = (
|
|
87
|
+
args: ReadonlyArray<string>,
|
|
88
|
+
options: { readonly active?: AuthProfile | null; readonly opens?: boolean }
|
|
89
|
+
) =>
|
|
90
|
+
Effect.gen(function*() {
|
|
91
|
+
const lines: Array<string> = []
|
|
92
|
+
const capture: Console.Console = Object.assign(Object.create(console), {
|
|
93
|
+
log: (...parts: ReadonlyArray<unknown>) => lines.push(parts.join(" "))
|
|
94
|
+
})
|
|
95
|
+
const cli = Command.runWith(
|
|
96
|
+
Command.make("jira").pipe(
|
|
97
|
+
Command.withSubcommands([makeAuthCommand(TestAuth, descriptor, { apiSection: "Jira API" })])
|
|
98
|
+
),
|
|
99
|
+
{ version: "0.0.0-test" }
|
|
100
|
+
)
|
|
101
|
+
const exit = yield* cli(["auth", ...args]).pipe(
|
|
102
|
+
Effect.provideService(Console.Console, capture),
|
|
103
|
+
Effect.provide(Layer.mergeAll(
|
|
104
|
+
NodeServices.layer,
|
|
105
|
+
launchers(options.opens ?? true),
|
|
106
|
+
Layer.succeed(TestAuth, fakeAuth(options.active ?? null))
|
|
107
|
+
)),
|
|
108
|
+
Effect.exit
|
|
109
|
+
)
|
|
110
|
+
return { exit, output: lines.join("\n") }
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
describe("makeAuthCommand", () => {
|
|
114
|
+
it("lists every login scope except offline_access, read:me under User Identity", () => {
|
|
115
|
+
const text = scopeInstructions(descriptor, "Jira API")
|
|
116
|
+
for (const scope of SCOPES.filter((scope) => scope !== "offline_access")) expect(text).toContain(scope)
|
|
117
|
+
expect(text).not.toContain("offline_access")
|
|
118
|
+
expect(text.indexOf("User Identity API")).toBeLessThan(text.indexOf("read:me"))
|
|
119
|
+
expect(text.indexOf("Jira API")).toBeLessThan(text.indexOf("read:jira-work"))
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
it.effect("create prints the service's scopes and its own command name, then opens the console", () =>
|
|
123
|
+
Effect.gen(function*() {
|
|
124
|
+
const { exit, output } = yield* run(["create"], {})
|
|
125
|
+
expect(exit._tag).toBe("Success")
|
|
126
|
+
for (const scope of ["write:jira-work", "manage:jira-project"]) expect(output).toContain(scope)
|
|
127
|
+
expect(output).toContain("jira auth configure --client-id")
|
|
128
|
+
expect(output).toContain("Opening https://developer.atlassian.com/console/myapps/create-3lo-app/")
|
|
129
|
+
}))
|
|
130
|
+
|
|
131
|
+
it.effect("create and manage fail when no browser opens, after printing the URL", () =>
|
|
132
|
+
Effect.gen(function*() {
|
|
133
|
+
for (const subcommand of ["create", "manage"]) {
|
|
134
|
+
const { exit, output } = yield* run([subcommand], { opens: false })
|
|
135
|
+
expect(exit._tag, subcommand).toBe("Failure")
|
|
136
|
+
expect(output, subcommand).toContain("Opening https://developer.atlassian.com/console/myapps/")
|
|
137
|
+
}
|
|
138
|
+
}))
|
|
139
|
+
|
|
140
|
+
it.effect("status prints the active profile, or how to log in", () =>
|
|
141
|
+
Effect.gen(function*() {
|
|
142
|
+
const active = yield* run(["status"], { active: profile })
|
|
143
|
+
expect(active.output).toContain("Active profile: User 1 @ site-1")
|
|
144
|
+
expect(active.output).toContain("Account: User 1 (user-1@example.com)")
|
|
145
|
+
expect(active.output).toContain("Site: https://site-1.atlassian.net")
|
|
146
|
+
expect((yield* run(["status"], {})).output).toContain("Not logged in. Use 'jira auth login' to authenticate.")
|
|
147
|
+
}))
|
|
148
|
+
|
|
149
|
+
it.effect("profiles marks the active one; use and remove fail typed on an unknown selector", () =>
|
|
150
|
+
Effect.gen(function*() {
|
|
151
|
+
expect((yield* run(["profiles"], { active: profile })).output).toContain("* cloud-1:account-1")
|
|
152
|
+
for (const subcommand of ["use", "remove"]) {
|
|
153
|
+
const { exit } = yield* run([subcommand, "nope"], {})
|
|
154
|
+
expect(Exit.isFailure(exit) && Cause.squash(exit.cause), subcommand).toMatchObject({
|
|
155
|
+
_tag: "ProfileNotFoundError",
|
|
156
|
+
message: "Profile not found: nope",
|
|
157
|
+
selector: "nope"
|
|
158
|
+
})
|
|
159
|
+
}
|
|
160
|
+
}))
|
|
161
|
+
})
|
|
@@ -137,9 +137,17 @@ const observedServerFactory = (stopped: Ref.Ref<boolean>) =>
|
|
|
137
137
|
)
|
|
138
138
|
)
|
|
139
139
|
|
|
140
|
-
const captureConsole = (lines: Array<string>): Console.Console =>
|
|
140
|
+
const captureConsole = (lines: Array<string>, waiting?: Deferred.Deferred<void>): Console.Console =>
|
|
141
141
|
Object.assign(Object.create(console), {
|
|
142
|
-
log: (...args: ReadonlyArray<unknown>) =>
|
|
142
|
+
log: (...args: ReadonlyArray<unknown>) => {
|
|
143
|
+
const line = args.join(" ")
|
|
144
|
+
lines.push(line)
|
|
145
|
+
// Login prints this right before it starts its authorization deadline,
|
|
146
|
+
// without suspending in between.
|
|
147
|
+
if (waiting !== undefined && line.startsWith("Waiting for authorization")) {
|
|
148
|
+
Deferred.doneUnsafe(waiting, Effect.void)
|
|
149
|
+
}
|
|
150
|
+
},
|
|
143
151
|
error: (...args: ReadonlyArray<unknown>) => lines.push(`stderr: ${args.join(" ")}`)
|
|
144
152
|
})
|
|
145
153
|
|
|
@@ -235,6 +243,7 @@ describe("Atlassian CLI login", () => {
|
|
|
235
243
|
const attempts = yield* Ref.make<ReadonlyArray<string>>([])
|
|
236
244
|
const lines: Array<string> = []
|
|
237
245
|
const stopped = yield* Ref.make(false)
|
|
246
|
+
const waiting = yield* Deferred.make<void>()
|
|
238
247
|
|
|
239
248
|
const login = yield* makeAtlassianCliAuth(authOptions).pipe(
|
|
240
249
|
Effect.flatMap((auth) => auth.login()),
|
|
@@ -245,18 +254,14 @@ describe("Atlassian CLI login", () => {
|
|
|
245
254
|
failingLaunchers(launched, attempts),
|
|
246
255
|
observedServerFactory(stopped)
|
|
247
256
|
)),
|
|
248
|
-
Effect.provideService(Console.Console, captureConsole(lines)),
|
|
257
|
+
Effect.provideService(Console.Console, captureConsole(lines, waiting)),
|
|
249
258
|
Effect.flip,
|
|
250
259
|
Effect.forkChild({ startImmediately: true })
|
|
251
260
|
)
|
|
252
261
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
for (let minute = 0; minute < 10; minute++) {
|
|
257
|
-
yield* TestClock.adjust("1 minute")
|
|
258
|
-
yield* Effect.yieldNow
|
|
259
|
-
}
|
|
262
|
+
// The login fiber has started its five-minute deadline by the time this resumes.
|
|
263
|
+
yield* Deferred.await(waiting)
|
|
264
|
+
yield* TestClock.adjust("5 minutes")
|
|
260
265
|
const error = yield* Fiber.join(login)
|
|
261
266
|
|
|
262
267
|
expect(error._tag).toBe("OAuthError")
|