@thegitai/cli 1.0.0-beta.8 → 1.0.0-beta.9

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/bin/ai.js CHANGED
@@ -20,12 +20,6 @@ const { auth, chat, models, sessions } = ServerApi;
20
20
  function printUsage() {
21
21
  console.log(formatCliHelpText({ color: process.stdout.isTTY === true }));
22
22
  }
23
- function commandFlagValue(args, name) {
24
- const index = args.indexOf(name);
25
- if (index === -1)
26
- return null;
27
- return args[index + 1] ?? null;
28
- }
29
23
  async function promptText(question, fallback = null) {
30
24
  const rl = readline.createInterface({ input, output });
31
25
  try {
@@ -42,17 +36,16 @@ function appendPromptHistory(prompt, env = process.env) {
42
36
  }
43
37
  async function runAuthCommand(command, args) {
44
38
  if (command === 'login') {
45
- const serverUrl = commandFlagValue(args, '--server') ??
46
- process.env.THEGITAI_SERVER_URL ??
47
- DEFAULT_SERVER_URL;
48
- const websiteUrl = commandFlagValue(args, '--website') ?? undefined;
39
+ // The public CLI always authenticates against the official TheGitAI host.
40
+ // There is intentionally no server/website override here — internal dev
41
+ // uses private tooling, not a customer-visible runtime override path.
42
+ const serverUrl = DEFAULT_SERVER_URL;
49
43
  const noBrowser = args.includes('--no-browser');
50
44
  console.log(chalk.dim(noBrowser
51
45
  ? 'Sign in on the website, then paste the authorization code here.'
52
46
  : 'Opening your browser to sign in…'));
53
47
  const result = await loginViaBrowser({
54
48
  serverUrl,
55
- websiteUrl,
56
49
  noBrowser,
57
50
  onUrl: (url) => {
58
51
  console.log(chalk.dim(noBrowser ? 'Open this URL to sign in:' : 'If your browser did not open, visit:'));
@@ -4,7 +4,6 @@ import os from 'node:os';
4
4
  import { openUrl } from '../core/open-url.js';
5
5
  import { ServerApiError, createTraceContext, failureMessage, normalizeServerUrl, readJsonResponse, } from './http.js';
6
6
  const DEFAULT_WEBSITE_URL = 'https://thegit.ai';
7
- const DEFAULT_DEV_WEBSITE_URL = 'http://localhost:3002';
8
7
  const DEFAULT_SERVER_URL = 'https://thegit.ai';
9
8
  const DEFAULT_TIMEOUT_MS = 5 * 60 * 1000;
10
9
  function shutDownServer(server) {
@@ -13,29 +12,11 @@ function shutDownServer(server) {
13
12
  server.closeAllConnections?.();
14
13
  server.close();
15
14
  }
16
- function isLocalhostUrl(url) {
17
- if (!url)
18
- return false;
19
- try {
20
- const host = new URL(url).hostname;
21
- return host === 'localhost' || host === '127.0.0.1' || host === '::1';
22
- }
23
- catch {
24
- return false;
25
- }
26
- }
27
- export function resolveWebsiteUrl(websiteUrl, env = process.env, serverUrl) {
28
- const explicit = String(websiteUrl ?? '').trim() ||
29
- String(env.THEGITAI_WEBSITE_URL ?? '').trim();
30
- // With no explicit override, point at production — unless we're clearly in
31
- // local dev (talking to a localhost server), in which case default to the
32
- // local website so `ai login` works without any flags or env vars.
33
- const value = explicit || (isLocalhostUrl(serverUrl) ? DEFAULT_DEV_WEBSITE_URL : DEFAULT_WEBSITE_URL);
34
- const normalized = value.replace(/\/+$/, '');
35
- if (!/^https?:\/\//i.test(normalized)) {
36
- throw new Error('Website URL must start with http:// or https://.');
37
- }
38
- return normalized;
15
+ export function resolveWebsiteUrl() {
16
+ // The public CLI always signs in through the official TheGitAI website. There
17
+ // is no override path here so the published package cannot be pointed at a
18
+ // clone host.
19
+ return DEFAULT_WEBSITE_URL.replace(/\/+$/, '');
39
20
  }
40
21
  function defaultDeviceName() {
41
22
  try {
@@ -104,7 +85,7 @@ async function exchangeCodeForToken({ serverUrl, code, codeVerifier, fetchImpl,
104
85
  */
105
86
  export async function loginViaBrowser(options) {
106
87
  const serverUrl = normalizeServerUrl(options.serverUrl ?? DEFAULT_SERVER_URL);
107
- const websiteUrl = resolveWebsiteUrl(options.websiteUrl, process.env, serverUrl);
88
+ const websiteUrl = resolveWebsiteUrl();
108
89
  const fetchImpl = options.fetchImpl ?? globalThis.fetch;
109
90
  const openBrowser = options.openBrowser ?? openUrl;
110
91
  const onUrl = options.onUrl ?? (() => { });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thegitai/cli",
3
- "version": "1.0.0-beta.8",
3
+ "version": "1.0.0-beta.9",
4
4
  "description": "TheGitAI CLI client (source-visible, proprietary)",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "homepage": "https://thegit.ai",
@@ -27,10 +27,10 @@
27
27
  "web-tree-sitter": "^0.26.6"
28
28
  },
29
29
  "optionalDependencies": {
30
- "@thegitai/tui-darwin-arm64": "1.0.0-beta.8",
31
- "@thegitai/tui-darwin-x64": "1.0.0-beta.8",
32
- "@thegitai/tui-linux-x64": "1.0.0-beta.8",
33
- "@thegitai/tui-win32-x64": "1.0.0-beta.8"
30
+ "@thegitai/tui-darwin-arm64": "1.0.0-beta.9",
31
+ "@thegitai/tui-darwin-x64": "1.0.0-beta.9",
32
+ "@thegitai/tui-linux-x64": "1.0.0-beta.9",
33
+ "@thegitai/tui-win32-x64": "1.0.0-beta.9"
34
34
  },
35
35
  "publishConfig": {
36
36
  "access": "public"