@staff0rd/assist 0.46.0 → 0.47.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/README.md CHANGED
@@ -72,6 +72,7 @@ After installation, the `assist` command will be available globally.
72
72
  - `assist deploy redirect` - Add trailing slash redirect script to index.html
73
73
  - `assist notify` - Show desktop notification from JSON stdin (supports macOS, Windows, WSL)
74
74
  - `assist status-line` - Format Claude Code status line from JSON stdin
75
+ - `assist complexity <pattern>` - Analyze a file (all metrics if single match, maintainability if multiple)
75
76
  - `assist complexity cyclomatic [pattern]` - Calculate cyclomatic complexity per function
76
77
  - `assist complexity halstead [pattern]` - Calculate Halstead metrics per function
77
78
  - `assist complexity maintainability [pattern]` - Calculate maintainability index per file
@@ -4,11 +4,55 @@ import enquirer from "enquirer";
4
4
  import { promptConfirm } from "../../../shared/promptConfirm";
5
5
  import { getExistingSiteId, updateWorkflow } from "./updateWorkflow";
6
6
 
7
+ async function ensureNetlifyCli(): Promise<void> {
8
+ try {
9
+ execSync("netlify sites:create --disable-linking", { stdio: "inherit" });
10
+ } catch (error) {
11
+ if (
12
+ !(error instanceof Error) ||
13
+ !error.message.includes("command not found")
14
+ )
15
+ throw error;
16
+
17
+ console.error(chalk.red("\nNetlify CLI is not installed.\n"));
18
+ const install = await promptConfirm("Would you like to install it now?");
19
+ if (!install) {
20
+ console.log(
21
+ chalk.yellow(
22
+ "\nInstall it manually with: npm install -g netlify-cli\n",
23
+ ),
24
+ );
25
+ process.exit(1);
26
+ }
27
+
28
+ console.log(chalk.dim("\nInstalling netlify-cli...\n"));
29
+ execSync("npm install -g netlify-cli", { stdio: "inherit" });
30
+ console.log();
31
+ execSync("netlify sites:create --disable-linking", { stdio: "inherit" });
32
+ }
33
+ }
34
+
35
+ function printSetupInstructions(): void {
36
+ console.log(chalk.bold("\nDeployment initialized successfully!"));
37
+ console.log(
38
+ chalk.yellow("\nTo complete setup, create a personal access token at:"),
39
+ );
40
+ console.log(
41
+ chalk.cyan(
42
+ "https://app.netlify.com/user/applications#personal-access-tokens",
43
+ ),
44
+ );
45
+ console.log(
46
+ chalk.yellow(
47
+ "\nThen add it as NETLIFY_AUTH_TOKEN in your GitHub repository secrets.",
48
+ ),
49
+ );
50
+ }
51
+
7
52
  export async function init(): Promise<void> {
8
53
  console.log(chalk.bold("Initializing Netlify deployment...\n"));
9
54
 
10
55
  const existingSiteId = getExistingSiteId();
11
-
12
56
  if (existingSiteId) {
13
57
  console.log(chalk.dim(`Using existing site ID: ${existingSiteId}\n`));
14
58
  await updateWorkflow(existingSiteId);
@@ -16,33 +60,7 @@ export async function init(): Promise<void> {
16
60
  }
17
61
 
18
62
  console.log("Creating Netlify site...\n");
19
- try {
20
- execSync("netlify sites:create --disable-linking", {
21
- stdio: "inherit",
22
- });
23
- } catch (error) {
24
- if (error instanceof Error && error.message.includes("command not found")) {
25
- console.error(chalk.red("\nNetlify CLI is not installed.\n"));
26
- const install = await promptConfirm("Would you like to install it now?");
27
- if (install) {
28
- console.log(chalk.dim("\nInstalling netlify-cli...\n"));
29
- execSync("npm install -g netlify-cli", { stdio: "inherit" });
30
- console.log();
31
- execSync("netlify sites:create --disable-linking", {
32
- stdio: "inherit",
33
- });
34
- } else {
35
- console.log(
36
- chalk.yellow(
37
- "\nInstall it manually with: npm install -g netlify-cli\n",
38
- ),
39
- );
40
- process.exit(1);
41
- }
42
- } else {
43
- throw error;
44
- }
45
- }
63
+ await ensureNetlifyCli();
46
64
 
47
65
  const { siteId } = await enquirer.prompt<{ siteId: string }>({
48
66
  type: "input",
@@ -53,19 +71,5 @@ export async function init(): Promise<void> {
53
71
  });
54
72
 
55
73
  await updateWorkflow(siteId);
56
-
57
- console.log(chalk.bold("\nDeployment initialized successfully!"));
58
- console.log(
59
- chalk.yellow("\nTo complete setup, create a personal access token at:"),
60
- );
61
- console.log(
62
- chalk.cyan(
63
- "https://app.netlify.com/user/applications#personal-access-tokens",
64
- ),
65
- );
66
- console.log(
67
- chalk.yellow(
68
- "\nThen add it as NETLIFY_AUTH_TOKEN in your GitHub repository secrets.",
69
- ),
70
- );
74
+ printSetupInstructions();
71
75
  }