@aligndottech/cli 0.24.1 → 0.26.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.
Files changed (77) hide show
  1. package/dist/commands/check.d.ts +21 -0
  2. package/dist/commands/check.d.ts.map +1 -1
  3. package/dist/commands/check.js +27 -1
  4. package/dist/commands/check.js.map +1 -1
  5. package/dist/commands/connect-agents.d.ts +27 -0
  6. package/dist/commands/connect-agents.d.ts.map +1 -0
  7. package/dist/commands/connect-agents.js +63 -0
  8. package/dist/commands/connect-agents.js.map +1 -0
  9. package/dist/commands/default-action.d.ts.map +1 -1
  10. package/dist/commands/default-action.js +5 -0
  11. package/dist/commands/default-action.js.map +1 -1
  12. package/dist/commands/dev/index.d.ts.map +1 -1
  13. package/dist/commands/dev/index.js +2 -1
  14. package/dist/commands/dev/index.js.map +1 -1
  15. package/dist/commands/import/confluence.d.ts.map +1 -1
  16. package/dist/commands/import/confluence.js +2 -1
  17. package/dist/commands/import/confluence.js.map +1 -1
  18. package/dist/commands/import/git.d.ts.map +1 -1
  19. package/dist/commands/import/git.js +2 -1
  20. package/dist/commands/import/git.js.map +1 -1
  21. package/dist/commands/import/github.d.ts.map +1 -1
  22. package/dist/commands/import/github.js +2 -1
  23. package/dist/commands/import/github.js.map +1 -1
  24. package/dist/commands/import/gitlab.d.ts.map +1 -1
  25. package/dist/commands/import/gitlab.js +2 -1
  26. package/dist/commands/import/gitlab.js.map +1 -1
  27. package/dist/commands/import/jira.d.ts.map +1 -1
  28. package/dist/commands/import/jira.js +2 -1
  29. package/dist/commands/import/jira.js.map +1 -1
  30. package/dist/commands/import/linear.d.ts.map +1 -1
  31. package/dist/commands/import/linear.js +2 -1
  32. package/dist/commands/import/linear.js.map +1 -1
  33. package/dist/commands/import/notion.d.ts.map +1 -1
  34. package/dist/commands/import/notion.js +2 -1
  35. package/dist/commands/import/notion.js.map +1 -1
  36. package/dist/commands/import/slack.d.ts.map +1 -1
  37. package/dist/commands/import/slack.js +2 -1
  38. package/dist/commands/import/slack.js.map +1 -1
  39. package/dist/commands/import/teams.d.ts.map +1 -1
  40. package/dist/commands/import/teams.js +2 -1
  41. package/dist/commands/import/teams.js.map +1 -1
  42. package/dist/commands/import/zoom.d.ts.map +1 -1
  43. package/dist/commands/import/zoom.js +2 -1
  44. package/dist/commands/import/zoom.js.map +1 -1
  45. package/dist/commands/local.d.ts.map +1 -1
  46. package/dist/commands/local.js +5 -2
  47. package/dist/commands/local.js.map +1 -1
  48. package/dist/commands/login.d.ts.map +1 -1
  49. package/dist/commands/login.js +2 -1
  50. package/dist/commands/login.js.map +1 -1
  51. package/dist/commands/mcp.d.ts.map +1 -1
  52. package/dist/commands/mcp.js +47 -2
  53. package/dist/commands/mcp.js.map +1 -1
  54. package/dist/commands/setup.d.ts.map +1 -1
  55. package/dist/commands/setup.js +166 -127
  56. package/dist/commands/setup.js.map +1 -1
  57. package/dist/lib/brand.d.ts +59 -0
  58. package/dist/lib/brand.d.ts.map +1 -0
  59. package/dist/lib/brand.js +197 -0
  60. package/dist/lib/brand.js.map +1 -0
  61. package/dist/lib/gateway-client.d.ts +15 -2
  62. package/dist/lib/gateway-client.d.ts.map +1 -1
  63. package/dist/lib/gateway-client.js +5 -0
  64. package/dist/lib/gateway-client.js.map +1 -1
  65. package/dist/lib/local-mode.d.ts +6 -3
  66. package/dist/lib/local-mode.d.ts.map +1 -1
  67. package/dist/lib/local-mode.js +16 -9
  68. package/dist/lib/local-mode.js.map +1 -1
  69. package/dist/lib/mcp-setup.d.ts +16 -0
  70. package/dist/lib/mcp-setup.d.ts.map +1 -1
  71. package/dist/lib/mcp-setup.js +48 -0
  72. package/dist/lib/mcp-setup.js.map +1 -1
  73. package/dist/lib/setup-ux.d.ts +38 -0
  74. package/dist/lib/setup-ux.d.ts.map +1 -0
  75. package/dist/lib/setup-ux.js +73 -0
  76. package/dist/lib/setup-ux.js.map +1 -0
  77. package/package.json +1 -1
@@ -0,0 +1,73 @@
1
+ import { execa } from 'execa';
2
+ /**
3
+ * Sizing and credential-discovery helpers for `align setup`.
4
+ *
5
+ * Lives outside setup.ts deliberately: that file is 833 lines and the 900-line
6
+ * ratchet is real, but more importantly these two are pure enough to test
7
+ * directly, which the flow around them is not.
8
+ */
9
+ // Lines the prompt needs beyond the option rows themselves: the message, clack's
10
+ // top and bottom rules, the submit hint, and enough slack that the previous
11
+ // command's last line is not overwritten.
12
+ const RESERVED_ROWS = 8;
13
+ // Below this a paginated list is unusable, so we overflow slightly rather than
14
+ // render one option at a time. clack scrolls within maxItems, so a floor is safe.
15
+ const MIN_VISIBLE = 3;
16
+ // Used when stdout is not a TTY and reports no size. 24 is the classic default.
17
+ const ASSUMED_ROWS = 24;
18
+ /**
19
+ * How many options `@clack/prompts` may render at once.
20
+ *
21
+ * Without this, clack draws every option and its in-place redraw miscounts once
22
+ * the list is taller than the viewport, duplicating rows on screen. An outside
23
+ * tester hit exactly that on 2026-08-30: seven connectors, a screenful of git
24
+ * import output above them, and "Notion" painted three times.
25
+ */
26
+ export function pickerMaxItems(rows, optionCount) {
27
+ const height = typeof rows === 'number' && Number.isFinite(rows) && rows > 0 ? rows : ASSUMED_ROWS;
28
+ const usable = Math.max(MIN_VISIBLE, height - RESERVED_ROWS);
29
+ return Math.min(optionCount, usable);
30
+ }
31
+ /**
32
+ * Read an already-authenticated token out of a local CLI, so a user who has
33
+ * `gh` set up is not sent to a browser to mint a PAT by hand.
34
+ *
35
+ * Returns null for every failure - not installed, not logged in, or authenticated
36
+ * but printing nothing. Null means "ask the user normally", so a broken or absent
37
+ * CLI degrades to the flow that existed before rather than to an error.
38
+ */
39
+ export async function detectCliToken(bin, args) {
40
+ try {
41
+ // execa rejects on a non-zero exit, so the catch covers "not logged in"; the
42
+ // explicit check covers a runner configured with reject:false upstream.
43
+ const result = await execa(bin, args, { timeout: 5_000 });
44
+ if (typeof result?.exitCode === 'number' && result.exitCode !== 0)
45
+ return null;
46
+ const token = String(result?.stdout ?? '').trim();
47
+ return token.length > 0 ? token : null;
48
+ }
49
+ catch {
50
+ return null;
51
+ }
52
+ }
53
+ /** Connectors whose token can be read from an already-authenticated local CLI. */
54
+ export const CLI_TOKEN_SOURCES = {
55
+ github: { bin: 'gh', args: ['auth', 'token'], label: 'GitHub CLI (gh)' },
56
+ };
57
+ /**
58
+ * Whether to use a token found in a local CLI, ask first, or ignore it.
59
+ *
60
+ * Separate from the prompt chain on purpose. `--approve` is documented as "Skip
61
+ * confirmation prompts (for scripted use)", and this repo has already shipped one
62
+ * prompt that ignored it - setup.ts still carries the comment about `align setup
63
+ * --approve` hanging when two agents were installed. A rule buried in an async
64
+ * prompt chain is not testable; this is.
65
+ */
66
+ export function cliTokenDecision(o) {
67
+ if (!o.token)
68
+ return 'skip';
69
+ // --approve means the affirmative, not the absence of the step: skipping the
70
+ // connector would silently drop a source the user could have had.
71
+ return o.approve ? 'use' : 'ask';
72
+ }
73
+ //# sourceMappingURL=setup-ux.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup-ux.js","sourceRoot":"","sources":["../../src/lib/setup-ux.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAE9B;;;;;;GAMG;AAEH,iFAAiF;AACjF,4EAA4E;AAC5E,0CAA0C;AAC1C,MAAM,aAAa,GAAG,CAAC,CAAC;AAExB,+EAA+E;AAC/E,kFAAkF;AAClF,MAAM,WAAW,GAAG,CAAC,CAAC;AAEtB,gFAAgF;AAChF,MAAM,YAAY,GAAG,EAAE,CAAC;AAExB;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAAC,IAAwB,EAAE,WAAmB;IAC1E,MAAM,MAAM,GAAG,OAAO,IAAI,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC;IACnG,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,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"@aligndottech/cli",
3
- "version": "0.24.1",
3
+ "version": "0.26.0",
4
4
  "mcpName": "io.github.aligndottech/cli",
5
5
  "type": "module",
6
6
  "description": "Align CLI - capture decisions, check alignment, and manage connectors",