@renaiss-shipflow/cli 0.16.0 → 0.16.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/dist/commands/activity.d.ts.map +1 -1
- package/dist/commands/activity.js +2 -4
- package/dist/commands/activity.js.map +1 -1
- package/dist/commands/channels.d.ts.map +1 -1
- package/dist/commands/channels.js +3 -6
- package/dist/commands/channels.js.map +1 -1
- package/dist/commands/claims.d.ts.map +1 -1
- package/dist/commands/claims.js +12 -24
- package/dist/commands/claims.js.map +1 -1
- package/dist/commands/features.d.ts.map +1 -1
- package/dist/commands/features.js +25 -37
- package/dist/commands/features.js.map +1 -1
- package/dist/commands/helpers.d.ts +61 -0
- package/dist/commands/helpers.d.ts.map +1 -1
- package/dist/commands/helpers.js +60 -6
- package/dist/commands/helpers.js.map +1 -1
- package/dist/commands/inbox.d.ts.map +1 -1
- package/dist/commands/inbox.js +17 -28
- package/dist/commands/inbox.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +3 -10
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/issue.d.ts.map +1 -1
- package/dist/commands/issue.js +22 -51
- package/dist/commands/issue.js.map +1 -1
- package/dist/commands/issues.d.ts.map +1 -1
- package/dist/commands/issues.js +9 -21
- package/dist/commands/issues.js.map +1 -1
- package/dist/commands/pr.d.ts.map +1 -1
- package/dist/commands/pr.js +44 -121
- package/dist/commands/pr.js.map +1 -1
- package/dist/commands/regression.d.ts.map +1 -1
- package/dist/commands/regression.js +4 -22
- package/dist/commands/regression.js.map +1 -1
- package/dist/commands/release.d.ts.map +1 -1
- package/dist/commands/release.js +9 -21
- package/dist/commands/release.js.map +1 -1
- package/dist/commands/repos.d.ts.map +1 -1
- package/dist/commands/repos.js +4 -9
- package/dist/commands/repos.js.map +1 -1
- package/dist/commands/stats.d.ts.map +1 -1
- package/dist/commands/stats.js +2 -4
- package/dist/commands/stats.js.map +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +14 -26
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/trigger.d.ts.map +1 -1
- package/dist/commands/trigger.js +3 -8
- package/dist/commands/trigger.js.map +1 -1
- package/dist/commands/workflows.d.ts.map +1 -1
- package/dist/commands/workflows.js +5 -10
- package/dist/commands/workflows.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"activity.d.ts","sourceRoot":"","sources":["../../src/commands/activity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"activity.d.ts","sourceRoot":"","sources":["../../src/commands/activity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA+B9D"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getApiCtx, runAction } from "./helpers.js";
|
|
2
2
|
import { formatOutput, printTable } from "../output.js";
|
|
3
3
|
export function registerActivityCommand(program) {
|
|
4
4
|
program
|
|
@@ -8,10 +8,8 @@ export function registerActivityCommand(program) {
|
|
|
8
8
|
.option("--json", "Output as JSON")
|
|
9
9
|
.option("--yaml", "Output as YAML")
|
|
10
10
|
.action(runAction(async (opts, cmd) => {
|
|
11
|
-
const client =
|
|
12
|
-
const org = getOrg(cmd);
|
|
11
|
+
const { client, org, format } = getApiCtx(cmd);
|
|
13
12
|
const limit = parseInt(opts.last, 10) || 10;
|
|
14
|
-
const format = getFormat(cmd);
|
|
15
13
|
const result = await client.listActivity(org, { limit });
|
|
16
14
|
const events = result.data;
|
|
17
15
|
formatOutput(format, events, () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"activity.js","sourceRoot":"","sources":["../../src/commands/activity.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"activity.js","sourceRoot":"","sources":["../../src/commands/activity.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAExD,MAAM,UAAU,uBAAuB,CAAC,OAAgB;IACtD,OAAO;SACJ,OAAO,CAAC,UAAU,CAAC;SACnB,WAAW,CAAC,+BAA+B,CAAC;SAC5C,MAAM,CAAC,YAAY,EAAE,iCAAiC,EAAE,IAAI,CAAC;SAC7D,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAClC,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAClC,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,IAAsB,EAAE,GAAY,EAAE,EAAE;QAC/D,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;QAC/C,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC;QAE5C,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QACzD,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC;QAE3B,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE;YAChC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACxB,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;gBACnC,OAAO;YACT,CAAC;YACD,UAAU,CACR,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,CAAC,EACjD,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;gBAChB,CAAC,CAAC,SAAS;gBACX,CAAC,CAAC,QAAQ,IAAK,CAAS,CAAC,YAAY,IAAI,GAAG;gBAC5C,CAAC,CAAC,YAAY;gBACd,CAAC,CAAC,MAAM;gBACP,CAAS,CAAC,YAAY,IAAI,GAAG;aAC/B,CAAC,CACH,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC,CAAC;AACR,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channels.d.ts","sourceRoot":"","sources":["../../src/commands/channels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"channels.d.ts","sourceRoot":"","sources":["../../src/commands/channels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAkD9D"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getApiCtx, runAction } from "./helpers.js";
|
|
2
2
|
import { formatOutput, printTable } from "../output.js";
|
|
3
3
|
export function registerChannelCommands(program) {
|
|
4
4
|
const channels = program
|
|
@@ -10,10 +10,8 @@ export function registerChannelCommands(program) {
|
|
|
10
10
|
.option("--json", "Output as JSON")
|
|
11
11
|
.option("--yaml", "Output as YAML")
|
|
12
12
|
.action(runAction(async (_opts, cmd) => {
|
|
13
|
-
const client =
|
|
14
|
-
const org = getOrg(cmd);
|
|
13
|
+
const { client, org, format } = getApiCtx(cmd);
|
|
15
14
|
const data = await client.listChannels(org);
|
|
16
|
-
const format = getFormat(cmd);
|
|
17
15
|
formatOutput(format, data, () => {
|
|
18
16
|
if (data.length === 0) {
|
|
19
17
|
console.log("No notification channels configured.");
|
|
@@ -35,8 +33,7 @@ export function registerChannelCommands(program) {
|
|
|
35
33
|
.requiredOption("--identifier <id>", "Channel identifier (e.g. channel ID, URL)")
|
|
36
34
|
.requiredOption("--label <name>", "Display label")
|
|
37
35
|
.action(runAction(async (opts, cmd) => {
|
|
38
|
-
const client =
|
|
39
|
-
const org = getOrg(cmd);
|
|
36
|
+
const { client, org } = getApiCtx(cmd);
|
|
40
37
|
const channel = await client.addChannel(org, {
|
|
41
38
|
channelType: opts.type,
|
|
42
39
|
channelIdentifier: opts.identifier,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channels.js","sourceRoot":"","sources":["../../src/commands/channels.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"channels.js","sourceRoot":"","sources":["../../src/commands/channels.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAExD,MAAM,UAAU,uBAAuB,CAAC,OAAgB;IACtD,MAAM,QAAQ,GAAG,OAAO;SACrB,OAAO,CAAC,UAAU,CAAC;SACnB,WAAW,CAAC,8BAA8B,CAAC,CAAC;IAE/C,QAAQ;SACL,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,4BAA4B,CAAC;SACzC,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAClC,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAClC,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,KAAc,EAAE,GAAY,EAAE,EAAE;QACvD,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;QAC/C,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;Q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EAAE,EAAE,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC,CAAC;AACR,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claims.d.ts","sourceRoot":"","sources":["../../src/commands/claims.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"claims.d.ts","sourceRoot":"","sources":["../../src/commands/claims.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGzC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAiB5D"}
|
package/dist/commands/claims.js
CHANGED
|
@@ -1,34 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { resolveApiUrl, resolveAuthToken, loadCredentials, refreshOpts } from "../config.js";
|
|
3
|
-
import { resolveProject } from "../project.js";
|
|
4
|
-
import { runAction } from "./helpers.js";
|
|
1
|
+
import { emit, loadCtx, runAction } from "./helpers.js";
|
|
5
2
|
export function registerClaimsCommand(program) {
|
|
6
3
|
program
|
|
7
4
|
.command("claims")
|
|
8
5
|
.description("List active agent claims (who is working on what)")
|
|
9
6
|
.option("--json", "Output JSON")
|
|
10
7
|
.action(runAction(async (opts) => {
|
|
11
|
-
const
|
|
12
|
-
const creds = loadCredentials();
|
|
13
|
-
if (!auth || !creds) {
|
|
14
|
-
console.error("Not signed in. Run: renaiss-shipflow login");
|
|
15
|
-
process.exit(1);
|
|
16
|
-
}
|
|
17
|
-
const client = new ShipFlowClient({ baseUrl: resolveApiUrl(program.opts().apiUrl), jwt: auth.token, ...refreshOpts(creds) });
|
|
18
|
-
const project = await resolveProject(client, creds);
|
|
8
|
+
const { creds, client, project } = await loadCtx(program);
|
|
19
9
|
const claims = await client.listClaims(creds.org, project.projectId);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
console.log(`#${c.issueNumber} ${c.repo} — ${c.actor}${agent}, expires ${c.expiresAt}`);
|
|
31
|
-
}
|
|
10
|
+
emit(opts, { claims }, () => {
|
|
11
|
+
if (claims.length === 0) {
|
|
12
|
+
console.log("No active claims — every open issue is up for grabs.");
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
for (const c of claims) {
|
|
16
|
+
const agent = c.agent ? ` (${c.agent})` : "";
|
|
17
|
+
console.log(`#${c.issueNumber} ${c.repo} — ${c.actor}${agent}, expires ${c.expiresAt}`);
|
|
18
|
+
}
|
|
19
|
+
}, { pretty: true });
|
|
32
20
|
}));
|
|
33
21
|
}
|
|
34
22
|
//# sourceMappingURL=claims.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claims.js","sourceRoot":"","sources":["../../src/commands/claims.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"claims.js","sourceRoot":"","sources":["../../src/commands/claims.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAExD,MAAM,UAAU,qBAAqB,CAAC,OAAgB;IACpD,OAAO;SACJ,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,mDAAmD,CAAC;SAChE,MAAM,CAAC,QAAQ,EAAE,aAAa,CAAC;SAC/B,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,IAAwB,EAAE,EAAE;QACnD,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;QAE1D,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;QACrE,IAAI,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE;YAC1B,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAAC,OAAO,CAAC,GAAG,CAAC,sDAAsD,CAAC,CAAC;gBAAC,OAAO;YAAC,CAAC;YACzG,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;gBACvB,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC7C,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,WAAW,IAAI,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,KAAK,GAAG,KAAK,aAAa,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC;YAC1F,CAAC;QACH,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC,CAAC;AACR,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features.d.ts","sourceRoot":"","sources":["../../src/commands/features.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"features.d.ts","sourceRoot":"","sources":["../../src/commands/features.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGzC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAoC9D"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { resolveApiUrl, resolveAuthToken, loadCredentials, refreshOpts } from "../config.js";
|
|
3
|
-
import { resolveProject } from "../project.js";
|
|
4
|
-
import { runAction } from "./helpers.js";
|
|
1
|
+
import { emit, loadCtx, runAction } from "./helpers.js";
|
|
5
2
|
export function registerFeaturesCommand(program) {
|
|
6
3
|
program
|
|
7
4
|
.command("features")
|
|
@@ -9,43 +6,34 @@ export function registerFeaturesCommand(program) {
|
|
|
9
6
|
.option("--json", "Output the raw feature map")
|
|
10
7
|
.option("--category <name>", "Filter to one category")
|
|
11
8
|
.action(runAction(async (opts) => {
|
|
12
|
-
const
|
|
13
|
-
const creds = loadCredentials();
|
|
14
|
-
if (!auth || !creds) {
|
|
15
|
-
console.error("Not signed in. Run: renaiss-shipflow login");
|
|
16
|
-
process.exit(1);
|
|
17
|
-
}
|
|
18
|
-
const client = new ShipFlowClient({ baseUrl: resolveApiUrl(program.opts().apiUrl), jwt: auth.token, ...refreshOpts(creds) });
|
|
19
|
-
const project = await resolveProject(client, creds);
|
|
9
|
+
const { creds, client, project } = await loadCtx(program);
|
|
20
10
|
const fm = await client.getFeatureMapping(creds.org, project.projectId);
|
|
21
11
|
const features = fm.features ?? {};
|
|
22
12
|
const keys = Object.keys(features).filter((k) => !opts.category || (features[k].category ?? "") === opts.category);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
if (!keys.length) {
|
|
29
|
-
console.log("No feature map for this project yet. Generate it from the ShipFlow dashboard.");
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
const byCat = new Map();
|
|
33
|
-
for (const k of keys) {
|
|
34
|
-
const cat = features[k].category || "uncategorized";
|
|
35
|
-
if (!byCat.has(cat))
|
|
36
|
-
byCat.set(cat, []);
|
|
37
|
-
byCat.get(cat).push(k);
|
|
38
|
-
}
|
|
39
|
-
console.log(`🗺️ Feature map — ${keys.length} feature(s)${fm.lastUpdated ? ` (updated ${fm.lastUpdated})` : ""}`);
|
|
40
|
-
for (const [cat, ks] of [...byCat].sort((a, b) => a[0].localeCompare(b[0]))) {
|
|
41
|
-
console.log(`\n${cat}`);
|
|
42
|
-
for (const k of ks.sort()) {
|
|
43
|
-
const f = features[k];
|
|
44
|
-
const paths = f.paths ?? [];
|
|
45
|
-
const shown = paths.slice(0, 3).join(", ");
|
|
46
|
-
console.log(` • ${f.name || k}${f.test_priority ? ` [${f.test_priority}]` : ""}${shown ? ` — ${shown}${paths.length > 3 ? " …" : ""}` : ""}`);
|
|
13
|
+
const jsonOut = opts.category ? { ...fm, features: Object.fromEntries(keys.map((k) => [k, features[k]])) } : fm;
|
|
14
|
+
emit(opts, jsonOut, () => {
|
|
15
|
+
if (!keys.length) {
|
|
16
|
+
console.log("No feature map for this project yet. Generate it from the ShipFlow dashboard.");
|
|
17
|
+
return;
|
|
47
18
|
}
|
|
48
|
-
|
|
19
|
+
const byCat = new Map();
|
|
20
|
+
for (const k of keys) {
|
|
21
|
+
const cat = features[k].category || "uncategorized";
|
|
22
|
+
if (!byCat.has(cat))
|
|
23
|
+
byCat.set(cat, []);
|
|
24
|
+
byCat.get(cat).push(k);
|
|
25
|
+
}
|
|
26
|
+
console.log(`🗺️ Feature map — ${keys.length} feature(s)${fm.lastUpdated ? ` (updated ${fm.lastUpdated})` : ""}`);
|
|
27
|
+
for (const [cat, ks] of [...byCat].sort((a, b) => a[0].localeCompare(b[0]))) {
|
|
28
|
+
console.log(`\n${cat}`);
|
|
29
|
+
for (const k of ks.sort()) {
|
|
30
|
+
const f = features[k];
|
|
31
|
+
const paths = f.paths ?? [];
|
|
32
|
+
const shown = paths.slice(0, 3).join(", ");
|
|
33
|
+
console.log(` • ${f.name || k}${f.test_priority ? ` [${f.test_priority}]` : ""}${shown ? ` — ${shown}${paths.length > 3 ? " …" : ""}` : ""}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}, { pretty: true });
|
|
49
37
|
}));
|
|
50
38
|
}
|
|
51
39
|
//# sourceMappingURL=features.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features.js","sourceRoot":"","sources":["../../src/commands/features.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"features.js","sourceRoot":"","sources":["../../src/commands/features.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI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,OAAO,CAAC,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBACjJ,CAAC;YACH,CAAC;QACH,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC,CAAC;AACR,CAAC"}
|
|
@@ -23,6 +23,20 @@ export declare function buildClientAuth(auth: {
|
|
|
23
23
|
* JWT commands (resolveAuthToken → buildClientAuth), so running `login` is
|
|
24
24
|
* enough to use everything. Exits 1 when nothing is signed in. */
|
|
25
25
|
export declare function getClient(cmd: Command): ShipFlowClient;
|
|
26
|
+
/** Resolve a JWT-authenticated client + the shared credential context WITHOUT
|
|
27
|
+
* resolving a project — the project-less core of {@link loadCtx}. For commands
|
|
28
|
+
* that hit an org-scoped endpoint but don't need the cwd's project (e.g.
|
|
29
|
+
* `regression status`), or that must run other checks before the project is
|
|
30
|
+
* resolved (`regression` trigger resolves the ref first). Exits 1 when not
|
|
31
|
+
* signed in. */
|
|
32
|
+
export declare function loadJwtCtx(program: Command): {
|
|
33
|
+
auth: {
|
|
34
|
+
token: string;
|
|
35
|
+
kind: "jwt" | "apiKey";
|
|
36
|
+
};
|
|
37
|
+
creds: StoredCredentials;
|
|
38
|
+
client: ShipFlowClient;
|
|
39
|
+
};
|
|
26
40
|
/** Bootstrap a JWT-authenticated client + resolved project for the loop-facing
|
|
27
41
|
* `pr`/`issue` commands. Signs in from stored credentials (JWT + refresh),
|
|
28
42
|
* wiring transparent token refresh, and resolves the active project from the
|
|
@@ -36,6 +50,53 @@ export declare function loadCtx(program: Command): Promise<{
|
|
|
36
50
|
client: ShipFlowClient;
|
|
37
51
|
project: import("../project.js").ResolvedProject;
|
|
38
52
|
}>;
|
|
53
|
+
/** Best-effort `signal`: on failure, warn (prefixing the message with `label` —
|
|
54
|
+
* e.g. "Merged but ShipFlow signal failed") and continue instead of throwing,
|
|
55
|
+
* so a transient signal blip never fails the surrounding command. Returns
|
|
56
|
+
* whether the signal landed. Omit `label` to swallow silently (no warning).
|
|
57
|
+
* The warn-and-continue semantics are load-bearing for the loop — keep exact. */
|
|
58
|
+
export declare function signalBestEffort(ctx: {
|
|
59
|
+
client: ShipFlowClient;
|
|
60
|
+
creds: {
|
|
61
|
+
org: string;
|
|
62
|
+
};
|
|
63
|
+
project: {
|
|
64
|
+
projectId: string;
|
|
65
|
+
};
|
|
66
|
+
}, refKind: "issues" | "prs", n: number, action: "claim" | "release-claim" | "opened" | "merged", body: Record<string, unknown>, label?: string): Promise<boolean>;
|
|
67
|
+
/** Resolve the shared context for the API-key-style commands in one call: an
|
|
68
|
+
* authenticated {@link getClient}, the target {@link getOrg}, and the requested
|
|
69
|
+
* {@link getFormat}. Preserves the getClient-first order so an unsigned-in
|
|
70
|
+
* invocation still exits 1 before anything else runs. */
|
|
71
|
+
export declare function getApiCtx(cmd: Command): {
|
|
72
|
+
client: ShipFlowClient;
|
|
73
|
+
org: string;
|
|
74
|
+
format: OutputFormat;
|
|
75
|
+
};
|
|
76
|
+
/** Unpack a `<number>` positional + optional `--repo` override into the numeric
|
|
77
|
+
* issue/PR number and the resolved repo (defaulting to the active project's).
|
|
78
|
+
* Collapses the `parseInt(numberStr, 10)` + `opts.repo ?? ctx.project.repoFullName`
|
|
79
|
+
* pair repeated across the `pr`/`issue` subcommands. */
|
|
80
|
+
export declare function resolveTarget(ctx: {
|
|
81
|
+
project: {
|
|
82
|
+
repoFullName: string;
|
|
83
|
+
};
|
|
84
|
+
}, numberStr: string, opts: {
|
|
85
|
+
repo?: string;
|
|
86
|
+
}): {
|
|
87
|
+
number: number;
|
|
88
|
+
repo: string;
|
|
89
|
+
};
|
|
90
|
+
/** Print a command's result once, honoring `--json`. In JSON mode, serializes
|
|
91
|
+
* `jsonValue` (compact by default; pretty-printed with 2-space indent when
|
|
92
|
+
* `pretty`) and returns; otherwise runs `humanPrint`. Replaces the hand-rolled
|
|
93
|
+
* `if (opts.json) { console.log(JSON.stringify(x)); return; }` branches across
|
|
94
|
+
* the commands — JSON output stays byte-identical. */
|
|
95
|
+
export declare function emit(opts: {
|
|
96
|
+
json?: boolean;
|
|
97
|
+
}, jsonValue: unknown, humanPrint: () => void, { pretty }?: {
|
|
98
|
+
pretty?: boolean;
|
|
99
|
+
}): void;
|
|
39
100
|
export declare function getOrg(cmd: Command): string;
|
|
40
101
|
export declare function getFormat(cmd: Command): OutputFormat;
|
|
41
102
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/commands/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAiE,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAErH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD;;;;qFAIqF;AACrF,MAAM,MAAM,UAAU,GAClB;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,CAAC,CAAC,EAAE,eAAe,KAAK,IAAI,CAAA;CAAE,GAChF;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvB,wBAAgB,eAAe,CAC7B,IAAI,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,KAAK,GAAG,QAAQ,CAAA;CAAE,EAC/C,KAAK,EAAE,iBAAiB,GAAG,IAAI,GAC9B,UAAU,C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AAED,wBAAgB,MAAM,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAE3C;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,YAAY,CAKpD;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAEvC;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,OAAO,EAAE,EAC3C,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GACvC,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAgB/B"}
|
package/dist/commands/helpers.js
CHANGED
|
@@ -22,21 +22,75 @@ export function getClient(cmd) {
|
|
|
22
22
|
}
|
|
23
23
|
return new ShipFlowClient({ baseUrl: resolveApiUrl(opts.apiUrl), ...buildClientAuth(auth, loadCredentials()) });
|
|
24
24
|
}
|
|
25
|
-
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
|
|
25
|
+
/** Resolve a JWT-authenticated client + the shared credential context WITHOUT
|
|
26
|
+
* resolving a project — the project-less core of {@link loadCtx}. For commands
|
|
27
|
+
* that hit an org-scoped endpoint but don't need the cwd's project (e.g.
|
|
28
|
+
* `regression status`), or that must run other checks before the project is
|
|
29
|
+
* resolved (`regression` trigger resolves the ref first). Exits 1 when not
|
|
30
|
+
* signed in. */
|
|
31
|
+
export function loadJwtCtx(program) {
|
|
30
32
|
const auth = resolveAuthToken();
|
|
31
33
|
const creds = loadCredentials();
|
|
32
34
|
if (!auth || !creds) {
|
|
33
35
|
console.error("Not signed in. Run: renaiss-shipflow login");
|
|
34
36
|
process.exit(1);
|
|
35
37
|
}
|
|
36
|
-
|
|
38
|
+
// optsWithGlobals ≡ opts() on the root program (no ancestors), but stays correct
|
|
39
|
+
// if a subcommand is ever passed (PR #187 review).
|
|
40
|
+
const client = new ShipFlowClient({ baseUrl: resolveApiUrl(program.optsWithGlobals().apiUrl), jwt: auth.token, ...refreshOpts(creds) });
|
|
41
|
+
return { auth, creds, client };
|
|
42
|
+
}
|
|
43
|
+
/** Bootstrap a JWT-authenticated client + resolved project for the loop-facing
|
|
44
|
+
* `pr`/`issue` commands. Signs in from stored credentials (JWT + refresh),
|
|
45
|
+
* wiring transparent token refresh, and resolves the active project from the
|
|
46
|
+
* cwd's repo. Exits 1 when not signed in. */
|
|
47
|
+
export async function loadCtx(program) {
|
|
48
|
+
const { auth, creds, client } = loadJwtCtx(program);
|
|
37
49
|
const project = await resolveProject(client, creds);
|
|
38
50
|
return { auth, creds, client, project };
|
|
39
51
|
}
|
|
52
|
+
/** Best-effort `signal`: on failure, warn (prefixing the message with `label` —
|
|
53
|
+
* e.g. "Merged but ShipFlow signal failed") and continue instead of throwing,
|
|
54
|
+
* so a transient signal blip never fails the surrounding command. Returns
|
|
55
|
+
* whether the signal landed. Omit `label` to swallow silently (no warning).
|
|
56
|
+
* The warn-and-continue semantics are load-bearing for the loop — keep exact. */
|
|
57
|
+
export async function signalBestEffort(ctx, refKind, n, action, body, label) {
|
|
58
|
+
try {
|
|
59
|
+
await ctx.client.signal(ctx.creds.org, ctx.project.projectId, refKind, n, action, body);
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
catch (e) {
|
|
63
|
+
if (label)
|
|
64
|
+
console.warn(`${label}: ${e instanceof Error ? e.message : String(e)}`);
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/** Resolve the shared context for the API-key-style commands in one call: an
|
|
69
|
+
* authenticated {@link getClient}, the target {@link getOrg}, and the requested
|
|
70
|
+
* {@link getFormat}. Preserves the getClient-first order so an unsigned-in
|
|
71
|
+
* invocation still exits 1 before anything else runs. */
|
|
72
|
+
export function getApiCtx(cmd) {
|
|
73
|
+
return { client: getClient(cmd), org: getOrg(cmd), format: getFormat(cmd) };
|
|
74
|
+
}
|
|
75
|
+
/** Unpack a `<number>` positional + optional `--repo` override into the numeric
|
|
76
|
+
* issue/PR number and the resolved repo (defaulting to the active project's).
|
|
77
|
+
* Collapses the `parseInt(numberStr, 10)` + `opts.repo ?? ctx.project.repoFullName`
|
|
78
|
+
* pair repeated across the `pr`/`issue` subcommands. */
|
|
79
|
+
export function resolveTarget(ctx, numberStr, opts) {
|
|
80
|
+
return { number: parseInt(numberStr, 10), repo: opts.repo ?? ctx.project.repoFullName };
|
|
81
|
+
}
|
|
82
|
+
/** Print a command's result once, honoring `--json`. In JSON mode, serializes
|
|
83
|
+
* `jsonValue` (compact by default; pretty-printed with 2-space indent when
|
|
84
|
+
* `pretty`) and returns; otherwise runs `humanPrint`. Replaces the hand-rolled
|
|
85
|
+
* `if (opts.json) { console.log(JSON.stringify(x)); return; }` branches across
|
|
86
|
+
* the commands — JSON output stays byte-identical. */
|
|
87
|
+
export function emit(opts, jsonValue, humanPrint, { pretty = false } = {}) {
|
|
88
|
+
if (opts.json) {
|
|
89
|
+
console.log(pretty ? JSON.stringify(jsonValue, null, 2) : JSON.stringify(jsonValue));
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
humanPrint();
|
|
93
|
+
}
|
|
40
94
|
export function getOrg(cmd) {
|
|
41
95
|
return cmd.optsWithGlobals().org || "default";
|
|
42
96
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/commands/helpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAwB,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,eAAe,EAAE,WAAW,EAA0B,MAAM,cAAc,CAAC;AACrH,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAY/C,MAAM,UAAU,eAAe,CAC7B,IAA+C,EAC/C,KAA+B;IAE/B,6EAA6E;IAC7E,4EAA4E;IAC5E,wDAAwD;IACxD,IAAI,IAAI,CAAC,IAAI,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AAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAA0G,CAAC;YAC3I,MAAM,IAAI,GAAG,OAAO,GAAG,EAAE,eAAe,KAAK,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,eAAe,EAAE;gBAC7E,CAAC,CAAC,OAAO,GAAG,EAAE,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACtD,IAAI,IAAI,EAAE,IAAI;gBAAE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;;gBAC3D,OAAO,CAAC,KAAK,CAAC,UAAU,OAAO,EAAE,CAAC,CAAC;YACxC,OAAO,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;QACrC,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inbox.d.ts","sourceRoot":"","sources":["../../src/commands/inbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"inbox.d.ts","sourceRoot":"","sources":["../../src/commands/inbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQzC,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAIrE;;4EAE4E;AAC5E,wBAAgB,yBAAyB,CACvC,YAAY,EAAE,MAAM;IAAE,UAAU,EAAE,OAAO,CAAA;CAAE,EAAE,GAC5C;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,CAMtC;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAgE3D"}
|
package/dist/commands/inbox.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { resolveApiUrl, resolveAuthToken, loadCredentials, refreshOpts, resolveStalePrHours } from "../config.js";
|
|
3
|
-
import { resolveProject } from "../project.js";
|
|
1
|
+
import { resolveStalePrHours } from "../config.js";
|
|
4
2
|
import { ghPRListMine, ghCurrentLogin, ghIssueListByLabel, ghReviewThreads } from "../gh.js";
|
|
5
3
|
import { classifyPR, issueNeedsReply } from "../pr-state.js";
|
|
6
|
-
import { runAction } from "./helpers.js";
|
|
4
|
+
import { emit, loadCtx, runAction } from "./helpers.js";
|
|
7
5
|
// Re-exported so existing import sites/tests (`../commands/inbox.js`) keep working
|
|
8
6
|
// now that the pure logic lives in pr-state.ts.
|
|
9
7
|
export { prAttentionReasons, issueNeedsReply } from "../pr-state.js";
|
|
@@ -26,14 +24,7 @@ export function registerInboxCommand(program) {
|
|
|
26
24
|
.option("--repo <fullname>", "Override target repo")
|
|
27
25
|
.option("--json", "Output JSON")
|
|
28
26
|
.action(runAction(async (opts) => {
|
|
29
|
-
const
|
|
30
|
-
const creds = loadCredentials();
|
|
31
|
-
if (!auth || !creds) {
|
|
32
|
-
console.error("Not signed in. Run: renaiss-shipflow login");
|
|
33
|
-
process.exit(1);
|
|
34
|
-
}
|
|
35
|
-
const client = new ShipFlowClient({ baseUrl: resolveApiUrl(program.opts().apiUrl), jwt: auth.token, ...refreshOpts(creds) });
|
|
36
|
-
const project = await resolveProject(client, creds);
|
|
27
|
+
const { project } = await loadCtx(program);
|
|
37
28
|
const repo = opts.repo ?? project.repoFullName;
|
|
38
29
|
const me = ghCurrentLogin();
|
|
39
30
|
const staleHours = resolveStalePrHours();
|
|
@@ -74,22 +65,20 @@ export function registerInboxCommand(program) {
|
|
|
74
65
|
parked: prs.filter((p) => p.state === "awaiting_review" || p.state === "ci_pending").length,
|
|
75
66
|
degraded,
|
|
76
67
|
};
|
|
77
|
-
|
|
78
|
-
console.log(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
for (const i of issues)
|
|
92
|
-
console.log(` ${i.needsAttention ? "💬" : "·"} #${i.number} — ${i.title}${i.newComment ? ` (last: @${i.newComment.author})` : ""}`);
|
|
68
|
+
emit(opts, { repo, prs, issues, summary }, () => {
|
|
69
|
+
console.log(`📥 Inbox for ${repo}`);
|
|
70
|
+
console.log(`Open PRs: ${prs.length} (${summary.prsNeedingAttention} need action, ${summary.readyToMerge} ready to merge) · in-progress issues: ${issues.length} (${summary.issuesNeedingAttention} with new comments)`);
|
|
71
|
+
if (degraded)
|
|
72
|
+
console.log(`⚠️ ${degraded} PR(s) with partial review-thread data (fetch blipped) — marked "degraded".`);
|
|
73
|
+
const icon = {
|
|
74
|
+
ci_failing: "🔴", changes_requested: "✏️ ", review_comments: "💬", ci_pending: "⏳",
|
|
75
|
+
approved_ready: "✅", stale: "🕰️ ", awaiting_review: "·",
|
|
76
|
+
};
|
|
77
|
+
for (const p of prs)
|
|
78
|
+
console.log(` ${icon[p.state] ?? "·"} PR #${p.number} [${p.state}] — ${p.title} (ci:${p.ciState}, ${p.ageHours}h)${"degraded" in p && p.degraded ? " ⚠️ degraded" : ""}`);
|
|
79
|
+
for (const i of issues)
|
|
80
|
+
console.log(` ${i.needsAttention ? "💬" : "·"} #${i.number} — ${i.title}${i.newComment ? ` (last: @${i.newComment.author})` : ""}`);
|
|
81
|
+
}, { pretty: true });
|
|
93
82
|
}));
|
|
94
83
|
}
|
|
95
84
|
//# sourceMappingURL=inbox.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inbox.js","sourceRoot":"","sources":["../../src/commands/inbox.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"inbox.js","sourceRoot":"","sources":["../../src/commands/inbox.ts"],"names":[],"mappings":"AACA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AAC,CAAC,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACjM,KAAK,MAAM,CAAC,IAAI,MAAM;gBAAE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,MAAM,MAAM,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAChK,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC,CAAC;AACR,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AASzC,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA2B1D"}
|
package/dist/commands/init.js
CHANGED
|
@@ -1,27 +1,20 @@
|
|
|
1
1
|
import { resolve } from "node:path";
|
|
2
|
-
import {
|
|
3
|
-
import { resolveApiUrl, resolveAuthToken, loadCredentials, refreshOpts, loadProjectCache, saveProjectCache, projectCacheKeyForRepoPath, } from "../config.js";
|
|
2
|
+
import { loadProjectCache, saveProjectCache, projectCacheKeyForRepoPath, } from "../config.js";
|
|
4
3
|
import { getCwdRepoRoot, getCwdRemote } from "../project.js";
|
|
5
4
|
import { promptSelect } from "../prompts.js";
|
|
6
|
-
import { runAction } from "./helpers.js";
|
|
5
|
+
import { loadJwtCtx, runAction } from "./helpers.js";
|
|
7
6
|
export function registerInitCommand(program) {
|
|
8
7
|
program
|
|
9
8
|
.command("init")
|
|
10
9
|
.description("Link the current repo to a ShipFlow project")
|
|
11
10
|
.action(runAction(async () => {
|
|
12
|
-
const
|
|
13
|
-
const creds = loadCredentials();
|
|
14
|
-
if (!auth || !creds) {
|
|
15
|
-
console.error("Not signed in. Run: renaiss-shipflow login");
|
|
16
|
-
process.exit(1);
|
|
17
|
-
}
|
|
11
|
+
const { creds, client } = loadJwtCtx(program);
|
|
18
12
|
const root = getCwdRepoRoot();
|
|
19
13
|
const remote = getCwdRemote();
|
|
20
14
|
if (!root || !remote) {
|
|
21
15
|
console.error("Not in a git repo with a github.com origin remote.");
|
|
22
16
|
process.exit(1);
|
|
23
17
|
}
|
|
24
|
-
const client = new ShipFlowClient({ baseUrl: resolveApiUrl(program.opts().apiUrl), jwt: auth.token, ...refreshOpts(creds) });
|
|
25
18
|
const lookup = await client.getRepoByFullName(creds.org, remote.owner, remote.repo);
|
|
26
19
|
if (!lookup.projects?.length) {
|
|
27
20
|
console.error(`Repo ${remote.owner}/${remote.repo} is not in any project on this org.`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,gBAAgB,EAAE,gBAAgB,EAAE,0BAA0B,GAC/D,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,SAAS,EAA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AAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;QACjC,KAAK,CAAC,0BAA0B,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG;YACjD,SAAS,EAAE,MAAM,CAAC,EAAE,EAAE,WAAW,EAAE,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ;SACzF,CAAC;QACF,gBAAgB,CAAC,KAAK,CAAC,CAAC;QACxB,OAAO,CAAC,GAAG,CAAC,UAAU,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,IAAI,MAAM,MAAM,CAAC,IAAI,GAAG,CAAC,CAAC;IACzE,CAAC,CAAC,CAAC,CAAC;AACR,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"issue.d.ts","sourceRoot":"","sources":["../../src/commands/issue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAezC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"issue.d.ts","sourceRoot":"","sources":["../../src/commands/issue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAezC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAiO3D"}
|