@nextsparkjs/cli 0.1.0-beta.85 → 0.1.0-beta.87
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/cli.js +122 -3
- package/package.json +9 -1
package/dist/cli.js
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
// src/cli.ts
|
|
13
13
|
import { config } from "dotenv";
|
|
14
14
|
import { Command } from "commander";
|
|
15
|
-
import
|
|
15
|
+
import chalk19 from "chalk";
|
|
16
16
|
import { readFileSync as readFileSync11 } from "fs";
|
|
17
17
|
|
|
18
18
|
// src/commands/dev.ts
|
|
@@ -434,7 +434,7 @@ import ora8 from "ora";
|
|
|
434
434
|
// src/wizard/index.ts
|
|
435
435
|
import chalk11 from "chalk";
|
|
436
436
|
import ora7 from "ora";
|
|
437
|
-
import { confirm as confirm5 } from "@inquirer/prompts";
|
|
437
|
+
import { confirm as confirm5, select as select6 } from "@inquirer/prompts";
|
|
438
438
|
import { execSync } from "child_process";
|
|
439
439
|
import { existsSync as existsSync7, readdirSync } from "fs";
|
|
440
440
|
import { join as join7 } from "path";
|
|
@@ -488,6 +488,9 @@ function showSection(title, step, totalSteps) {
|
|
|
488
488
|
console.log(chalk5.gray(" " + "-".repeat(40)));
|
|
489
489
|
console.log("");
|
|
490
490
|
}
|
|
491
|
+
function showSuccess(message) {
|
|
492
|
+
console.log(chalk5.green(` \u2713 ${message}`));
|
|
493
|
+
}
|
|
491
494
|
function showWarning(message) {
|
|
492
495
|
console.log(chalk5.yellow(` \u26A0 ${message}`));
|
|
493
496
|
}
|
|
@@ -3586,6 +3589,7 @@ async function runWizard(options = { mode: "interactive" }) {
|
|
|
3586
3589
|
const devCmd = isMonorepo ? "pnpm dev" : "pnpm dev";
|
|
3587
3590
|
console.log(chalk11.yellow(` Registries will be built automatically when you run "${devCmd}"`));
|
|
3588
3591
|
}
|
|
3592
|
+
await promptAIWorkflowSetup(config2);
|
|
3589
3593
|
showNextSteps(config2, selectedTheme);
|
|
3590
3594
|
} catch (error) {
|
|
3591
3595
|
if (error instanceof Error) {
|
|
@@ -3740,9 +3744,60 @@ function showNextSteps(config2, referenceTheme = null) {
|
|
|
3740
3744
|
const refPath = isMonorepo ? `web/contents/themes/${referenceTheme}/` : `contents/themes/${referenceTheme}/`;
|
|
3741
3745
|
console.log(chalk11.gray(` Reference: ${chalk11.white(refPath)}`));
|
|
3742
3746
|
}
|
|
3747
|
+
console.log("");
|
|
3748
|
+
console.log(chalk11.white(` ${isMonorepo ? "5" : "4"}. (Optional) Setup AI workflows:`));
|
|
3749
|
+
console.log(chalk11.cyan(" nextspark setup:ai"));
|
|
3750
|
+
console.log("");
|
|
3743
3751
|
console.log(chalk11.gray(" Docs: https://nextspark.dev/docs"));
|
|
3744
3752
|
console.log("");
|
|
3745
3753
|
}
|
|
3754
|
+
async function promptAIWorkflowSetup(config2) {
|
|
3755
|
+
console.log("");
|
|
3756
|
+
console.log(chalk11.cyan(" " + "=".repeat(60)));
|
|
3757
|
+
console.log(chalk11.bold.white(" AI Workflow Setup (Optional)"));
|
|
3758
|
+
console.log(chalk11.cyan(" " + "=".repeat(60)));
|
|
3759
|
+
console.log("");
|
|
3760
|
+
const choice = await select6({
|
|
3761
|
+
message: "Setup AI-assisted development workflows?",
|
|
3762
|
+
choices: [
|
|
3763
|
+
{ name: "Claude Code (Recommended)", value: "claude" },
|
|
3764
|
+
{ name: "Cursor (Coming soon)", value: "cursor" },
|
|
3765
|
+
{ name: "Antigravity (Coming soon)", value: "antigravity" },
|
|
3766
|
+
{ name: "Skip for now", value: "skip" }
|
|
3767
|
+
]
|
|
3768
|
+
});
|
|
3769
|
+
if (choice === "skip") {
|
|
3770
|
+
showInfo('Skipped AI workflow setup. Run "nextspark setup:ai" later to set up.');
|
|
3771
|
+
return;
|
|
3772
|
+
}
|
|
3773
|
+
if (choice === "cursor" || choice === "antigravity") {
|
|
3774
|
+
showInfo(`${choice} support is coming soon. For now, use Claude Code.`);
|
|
3775
|
+
return;
|
|
3776
|
+
}
|
|
3777
|
+
const projectRoot = process.cwd();
|
|
3778
|
+
const isMonorepo = isMonorepoProject(config2);
|
|
3779
|
+
try {
|
|
3780
|
+
execSync("pnpm add -D -w @nextsparkjs/ai-workflow", {
|
|
3781
|
+
cwd: projectRoot,
|
|
3782
|
+
stdio: "inherit"
|
|
3783
|
+
});
|
|
3784
|
+
let setupScript = join7(projectRoot, "node_modules", "@nextsparkjs", "ai-workflow", "scripts", "setup.mjs");
|
|
3785
|
+
if (!existsSync7(setupScript) && isMonorepo) {
|
|
3786
|
+
setupScript = join7(projectRoot, "web", "node_modules", "@nextsparkjs", "ai-workflow", "scripts", "setup.mjs");
|
|
3787
|
+
}
|
|
3788
|
+
if (existsSync7(setupScript)) {
|
|
3789
|
+
execSync(`node "${setupScript}" ${choice}`, {
|
|
3790
|
+
cwd: projectRoot,
|
|
3791
|
+
stdio: "inherit"
|
|
3792
|
+
});
|
|
3793
|
+
showSuccess("AI workflow setup complete!");
|
|
3794
|
+
} else {
|
|
3795
|
+
showWarning('AI workflow package installed but setup script not found. Run "nextspark setup:ai" manually.');
|
|
3796
|
+
}
|
|
3797
|
+
} catch (error) {
|
|
3798
|
+
showError('Failed to install AI workflow package. Run "nextspark setup:ai" later.');
|
|
3799
|
+
}
|
|
3800
|
+
}
|
|
3746
3801
|
function findLocalCoreTarball() {
|
|
3747
3802
|
const cwd = process.cwd();
|
|
3748
3803
|
try {
|
|
@@ -4878,6 +4933,69 @@ ${error.stack}
|
|
|
4878
4933
|
}
|
|
4879
4934
|
}
|
|
4880
4935
|
|
|
4936
|
+
// src/commands/setup-ai.ts
|
|
4937
|
+
import { existsSync as existsSync12 } from "fs";
|
|
4938
|
+
import { join as join12 } from "path";
|
|
4939
|
+
import { execSync as execSync3 } from "child_process";
|
|
4940
|
+
import chalk18 from "chalk";
|
|
4941
|
+
import ora12 from "ora";
|
|
4942
|
+
function resolveAIWorkflowPath() {
|
|
4943
|
+
const cwd = process.cwd();
|
|
4944
|
+
const nmPath = join12(cwd, "node_modules", "@nextsparkjs", "ai-workflow");
|
|
4945
|
+
if (existsSync12(nmPath)) return nmPath;
|
|
4946
|
+
const webNmPath = join12(cwd, "web", "node_modules", "@nextsparkjs", "ai-workflow");
|
|
4947
|
+
if (existsSync12(webNmPath)) return webNmPath;
|
|
4948
|
+
const monoPath = join12(cwd, "packages", "ai-workflow");
|
|
4949
|
+
if (existsSync12(monoPath)) return monoPath;
|
|
4950
|
+
return null;
|
|
4951
|
+
}
|
|
4952
|
+
var VALID_EDITORS = ["claude", "cursor", "antigravity", "all"];
|
|
4953
|
+
async function setupAICommand(options) {
|
|
4954
|
+
const editor = options.editor || "claude";
|
|
4955
|
+
if (!VALID_EDITORS.includes(editor)) {
|
|
4956
|
+
console.log(chalk18.red(` Unknown editor: ${editor}`));
|
|
4957
|
+
console.log(chalk18.gray(` Available: ${VALID_EDITORS.join(", ")}`));
|
|
4958
|
+
process.exit(1);
|
|
4959
|
+
}
|
|
4960
|
+
console.log("");
|
|
4961
|
+
console.log(chalk18.cyan(" AI Workflow Setup"));
|
|
4962
|
+
console.log(chalk18.gray(" " + "-".repeat(40)));
|
|
4963
|
+
console.log("");
|
|
4964
|
+
const pkgPath = resolveAIWorkflowPath();
|
|
4965
|
+
if (!pkgPath) {
|
|
4966
|
+
console.log(chalk18.red(" @nextsparkjs/ai-workflow package not found."));
|
|
4967
|
+
console.log("");
|
|
4968
|
+
console.log(chalk18.gray(" Install it first:"));
|
|
4969
|
+
console.log(chalk18.cyan(" pnpm add -D -w @nextsparkjs/ai-workflow"));
|
|
4970
|
+
console.log("");
|
|
4971
|
+
process.exit(1);
|
|
4972
|
+
}
|
|
4973
|
+
const setupScript = join12(pkgPath, "scripts", "setup.mjs");
|
|
4974
|
+
if (!existsSync12(setupScript)) {
|
|
4975
|
+
console.log(chalk18.red(" Setup script not found in ai-workflow package."));
|
|
4976
|
+
console.log(chalk18.gray(` Expected: ${setupScript}`));
|
|
4977
|
+
process.exit(1);
|
|
4978
|
+
}
|
|
4979
|
+
const spinner = ora12({
|
|
4980
|
+
text: `Setting up AI workflow for ${editor}...`,
|
|
4981
|
+
prefixText: " "
|
|
4982
|
+
}).start();
|
|
4983
|
+
try {
|
|
4984
|
+
spinner.stop();
|
|
4985
|
+
execSync3(`node "${setupScript}" ${editor}`, {
|
|
4986
|
+
cwd: process.cwd(),
|
|
4987
|
+
stdio: "inherit"
|
|
4988
|
+
});
|
|
4989
|
+
} catch (error) {
|
|
4990
|
+
console.log("");
|
|
4991
|
+
console.log(chalk18.red(" AI workflow setup failed."));
|
|
4992
|
+
if (error instanceof Error) {
|
|
4993
|
+
console.log(chalk18.gray(` ${error.message}`));
|
|
4994
|
+
}
|
|
4995
|
+
process.exit(1);
|
|
4996
|
+
}
|
|
4997
|
+
}
|
|
4998
|
+
|
|
4881
4999
|
// src/cli.ts
|
|
4882
5000
|
config();
|
|
4883
5001
|
var pkg = JSON.parse(readFileSync11(new URL("../package.json", import.meta.url), "utf-8"));
|
|
@@ -4902,8 +5020,9 @@ db.command("seed").description("Seed database with sample data").action(dbSeedCo
|
|
|
4902
5020
|
program.command("db:migrate").description("Run database migrations (alias)").action(dbMigrateCommand);
|
|
4903
5021
|
program.command("db:seed").description("Seed database with sample data (alias)").action(dbSeedCommand);
|
|
4904
5022
|
program.command("sync:app").description("Sync /app folder with @nextsparkjs/core templates").option("--dry-run", "Preview changes without applying").option("-f, --force", "Skip confirmation prompt").option("--backup", "Backup existing files before overwriting").option("-v, --verbose", "Show detailed file operations").action(syncAppCommand);
|
|
5023
|
+
program.command("setup:ai").description("Setup AI workflow for your editor (Claude Code, Cursor, Antigravity)").option("-e, --editor <editor>", "Editor to setup (claude, cursor, antigravity, all)", "claude").action(setupAICommand);
|
|
4905
5024
|
program.showHelpAfterError();
|
|
4906
5025
|
program.configureOutput({
|
|
4907
|
-
writeErr: (str) => process.stderr.write(
|
|
5026
|
+
writeErr: (str) => process.stderr.write(chalk19.red(str))
|
|
4908
5027
|
});
|
|
4909
5028
|
program.parse();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextsparkjs/cli",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.87",
|
|
4
4
|
"description": "NextSpark CLI - Complete development toolkit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -31,6 +31,14 @@
|
|
|
31
31
|
"typescript": "^5.0.0",
|
|
32
32
|
"@nextsparkjs/core": "0.1.0-beta.79"
|
|
33
33
|
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"@nextsparkjs/ai-workflow": "^0.1.0"
|
|
36
|
+
},
|
|
37
|
+
"peerDependenciesMeta": {
|
|
38
|
+
"@nextsparkjs/ai-workflow": {
|
|
39
|
+
"optional": true
|
|
40
|
+
}
|
|
41
|
+
},
|
|
34
42
|
"keywords": [
|
|
35
43
|
"nextspark",
|
|
36
44
|
"cli",
|