starpak 0.1.2 → 0.1.4

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 ADDED
@@ -0,0 +1,63 @@
1
+ # starpak ✨
2
+
3
+ > Universal package manager, but not just packages!
4
+
5
+ [中文文档](./README.zh.md)
6
+
7
+ **starpak** is an intent-driven universal deployment tool. One command turns any code (local project, GitHub repo, system package) into a running service.
8
+
9
+ ```
10
+ cd ./my-project && starpak install # install deps
11
+ starpak start # run it
12
+ starpak stop # stop it
13
+ starpak enable # systemd auto-start
14
+ starpak build # compile
15
+ starpak search <query> # search GitHub repos
16
+ starpak install -s nginx # install system package
17
+ starpak test install # dry-run install
18
+ starpak remove me # uninstall starpak itself
19
+ ```
20
+
21
+ ## How it works
22
+
23
+ 1. **Smart detection** — reads project files (package.json, Makefile, Cargo.toml, go.mod, etc.), identifies runtime and build system
24
+ 2. **Auto install** — installs deps, runs build, no manual config
25
+ 3. **Zero-config start** — `cd` into the project and `starpak start`, it just works
26
+ 4. **Multi-project** — detects frontend + backend separation, starts all sub-projects
27
+ 5. **Startup scripts** — prioritizes `start.sh` / `run.sh` over default entry points
28
+
29
+ ## Install
30
+
31
+ ```bash
32
+ npm install -g starpak
33
+ ```
34
+
35
+ ## Commands
36
+
37
+ | Command | Description |
38
+ |---------|-------------|
39
+ | `install [target]` | Install dependencies for the project |
40
+ | `install -s <pkg>` | Install a system package via apt |
41
+ | `start` | Start the project in current directory |
42
+ | `stop` | Stop the project |
43
+ | `restart` | Restart the project |
44
+ | `enable` | Configure systemd auto-start |
45
+ | `disable` | Disable systemd auto-start |
46
+ | `status` | Check running status |
47
+ | `logs` | View process logs |
48
+ | `build [target]` | Build the project |
49
+ | `build -r` | Rebuild (clean + build) |
50
+ | `remove -s <pkg>` | Remove a system package |
51
+ | `search <query>` | Search GitHub repositories |
52
+ | `test install` | Dry-run install (show detection without executing) |
53
+
54
+ ## Philosophy
55
+
56
+ - **cd in, the rest is automatic** — one command is all you need
57
+ - **No database, no tracking** — lives in your project directory, like npm
58
+ - **Adapt, don't replace** — stands on top of apt/npm/make/systemd, doesn't reinvent them
59
+ - **Easter egg** — `starpak remove me` uninstalls itself
60
+
61
+ ## License
62
+
63
+ Apache-2.0
package/README.zh.md ADDED
@@ -0,0 +1,63 @@
1
+ # starpak ✨
2
+
3
+ > 全能的包管理,但不只是管理包!
4
+
5
+ [English](./README.md)
6
+
7
+ **starpak** 是一个意图驱动的万能部署工具。一个命令就能把任何代码变成运行中的服务。
8
+
9
+ ```
10
+ cd ./my-project && starpak install # 安装依赖
11
+ starpak start # 启动项目
12
+ starpak stop # 停止项目
13
+ starpak enable # 配置 systemd 开机自启
14
+ starpak build # 构建项目
15
+ starpak search <关键词> # 搜索 GitHub 仓库
16
+ starpak install -s nginx # 安装系统包
17
+ starpak test install # 模拟安装(不真执行)
18
+ starpak remove me # 卸载 starpak 自己
19
+ ```
20
+
21
+ ## 工作原理
22
+
23
+ 1. **智能检测** — 读取项目文件(package.json、Makefile、Cargo.toml、go.mod 等),自动识别运行时和构建系统
24
+ 2. **自动安装** — 安装依赖、执行构建,无需手动配置
25
+ 3. **零配置启动** — `cd` 进项目目录,`starpak start` 就能跑
26
+ 4. **多项目支持** — 自动识别前后端分离项目,启动所有子服务
27
+ 5. **启动脚本优先** — 检测到 `start.sh` / `run.sh` 时优先使用
28
+
29
+ ## 安装
30
+
31
+ ```bash
32
+ npm install -g starpak
33
+ ```
34
+
35
+ ## 命令
36
+
37
+ | 命令 | 说明 |
38
+ |------|------|
39
+ | `install [target]` | 安装项目依赖 |
40
+ | `install -s <包名>` | 通过 apt 安装系统包 |
41
+ | `start` | 启动当前目录的项目 |
42
+ | `stop` | 停止当前目录的项目 |
43
+ | `restart` | 重启当前目录的项目 |
44
+ | `enable` | 配置 systemd 开机自启 |
45
+ | `disable` | 关闭 systemd 开机自启 |
46
+ | `status` | 查看运行状态 |
47
+ | `logs` | 查看运行日志 |
48
+ | `build [target]` | 构建项目 |
49
+ | `build -r` | 重新构建(先清理再构建) |
50
+ | `remove -s <包名>` | 卸载系统包 |
51
+ | `search <关键词>` | 搜索 GitHub 仓库 |
52
+ | `test install` | 模拟安装(显示分析结果,不真执行) |
53
+
54
+ ## 设计哲学
55
+
56
+ - **cd 进去,剩下的自动完成** — 一个命令就够了
57
+ - **无数据库,无追踪** — 活在项目目录里,像 npm 一样
58
+ - **适配而非替代** — 站在 apt/npm/make/systemd 之上,不重复造轮子
59
+ - **彩蛋** — `starpak remove me` 卸载 starpak 自己
60
+
61
+ ## 许可证
62
+
63
+ Apache-2.0
@@ -5495,7 +5495,7 @@ var zh = {
5495
5495
  "cmd.help.desc": "\u7785\u7785\u548B\u7528",
5496
5496
  "app.name": "starpak \u2728",
5497
5497
  "app.desc": "\u8BF6\u563F\uFF0C\u628A\u4F60\u4EE3\u7801\u53D8\u6210\u670D\u52A1\u7684\u9B54\u6CD5\u68D2\uFF5E cd \u8FDB\u53BB\uFF0C\u5269\u4E0B\u7684\u4EA4\u7ED9\u6211",
5498
- "app.version": "0.1.2",
5498
+ "app.version": "0.1.4",
5499
5499
  "help.usage.hint": "\u5514\u2026 \u7528 starpak --help \u770B\u770B\u6211\u80FD\u5E72\u5565\u5427",
5500
5500
  "cmd.install.desc": "\u5440\uFF0C\u88C5\u70B9\u5565\u597D\u4E1C\u897F\uFF1F",
5501
5501
  "cmd.install.arg.target": "\u9879\u76EE\u76EE\u5F55\u3001GitHub \u4ED3\u5E93\u6216\u5305\u540D\u5566",
@@ -5562,7 +5562,7 @@ var en = {
5562
5562
  "cmd.help.desc": "Show help",
5563
5563
  "app.name": "starpak \u2728",
5564
5564
  "app.desc": "A lil magic wand that turns your code into services~ cd in, leave the rest to me",
5565
- "app.version": "0.1.2",
5565
+ "app.version": "0.1.4",
5566
5566
  "help.usage.hint": "Hmm... try starpak --help to see what I can do~",
5567
5567
  "cmd.install.desc": "Install something nice",
5568
5568
  "cmd.install.arg.target": "Project dir, GitHub repo, or package name",
@@ -12443,8 +12443,12 @@ async function findSuspiciousFiles(dir, maxDepth = 4) {
12443
12443
  "start.sh",
12444
12444
  "run.sh",
12445
12445
  "start.bat",
12446
- "run.bat"
12446
+ "run.bat",
12447
+ "Package.swift",
12448
+ "build.gradle",
12449
+ "pom.xml"
12447
12450
  ]);
12451
+ const scriptTargets = /* @__PURE__ */ new Set([".sh", ".bat", ".py", ".rb", ".php", ".pl", ".lua"]);
12448
12452
  function scan(d, depth) {
12449
12453
  if (depth > maxDepth) return;
12450
12454
  try {
@@ -12491,7 +12495,6 @@ async function analyzeTechStack(files) {
12491
12495
  if (deps.includes("express")) frameworks.push("express");
12492
12496
  if (deps.includes("react")) frameworks.push("react");
12493
12497
  if (deps.includes("vue")) frameworks.push("vue");
12494
- if (deps.includes("svelte")) frameworks.push("svelte");
12495
12498
  entryPoint = json.main || json.bin || null;
12496
12499
  buildCommand = json.scripts?.build || null;
12497
12500
  startCommand = json.scripts?.start || null;
@@ -12502,9 +12505,7 @@ async function analyzeTechStack(files) {
12502
12505
  else if ((0, import_fs.existsSync)((0, import_path.join)(dir, "server.js"))) entryPoint = "server.js";
12503
12506
  else if ((0, import_fs.existsSync)((0, import_path.join)(dir, "main.js"))) entryPoint = "main.js";
12504
12507
  }
12505
- if (!startCommand) {
12506
- startCommand = entryPoint ? `node ${entryPoint}` : "node .";
12507
- }
12508
+ if (!startCommand) startCommand = entryPoint ? `node ${entryPoint}` : "node .";
12508
12509
  } catch {
12509
12510
  }
12510
12511
  }
@@ -12518,11 +12519,13 @@ async function analyzeTechStack(files) {
12518
12519
  if (types.includes("requirements.txt") || types.includes("setup.py") || types.includes("pyproject.toml")) {
12519
12520
  runtimes.push("python");
12520
12521
  systemDeps.push("python3", "python3-pip", "python3-venv");
12522
+ if (!startCommand) startCommand = "python3 main.py";
12521
12523
  }
12522
12524
  if (types.includes("Cargo.toml")) {
12523
12525
  runtimes.push("rust");
12524
12526
  systemDeps.push("rustc", "cargo");
12525
12527
  buildCommand = buildCommand || "cargo build --release";
12528
+ startCommand = startCommand || "./target/release/app";
12526
12529
  }
12527
12530
  if (types.includes("go.mod")) {
12528
12531
  runtimes.push("go");
@@ -12530,9 +12533,40 @@ async function analyzeTechStack(files) {
12530
12533
  buildCommand = buildCommand || "go build -o ./bin/app .";
12531
12534
  startCommand = startCommand || "./bin/app";
12532
12535
  }
12536
+ if (types.includes("Gemfile")) {
12537
+ runtimes.push("ruby");
12538
+ systemDeps.push("ruby", "bundler");
12539
+ buildCommand = buildCommand || "bundle install";
12540
+ startCommand = startCommand || "bundle exec ruby main.rb";
12541
+ }
12542
+ if (types.includes("composer.json")) {
12543
+ runtimes.push("php");
12544
+ systemDeps.push("php", "composer");
12545
+ buildCommand = buildCommand || "composer install";
12546
+ startCommand = startCommand || "php artisan serve";
12547
+ }
12548
+ if (types.includes("Package.swift")) {
12549
+ runtimes.push("swift");
12550
+ systemDeps.push("swift");
12551
+ buildCommand = buildCommand || "swift build";
12552
+ startCommand = startCommand || "swift run";
12553
+ }
12554
+ if (types.includes("pom.xml")) {
12555
+ runtimes.push("java");
12556
+ systemDeps.push("java", "maven");
12557
+ buildCommand = buildCommand || "mvn package";
12558
+ startCommand = startCommand || "mvn exec:java";
12559
+ }
12560
+ if (types.includes("build.gradle")) {
12561
+ runtimes.push("java");
12562
+ systemDeps.push("java", "gradle");
12563
+ buildCommand = buildCommand || "gradle build";
12564
+ startCommand = startCommand || "gradle run";
12565
+ }
12533
12566
  if (types.includes("Dockerfile")) {
12534
12567
  runtimes.push("docker");
12535
12568
  buildCommand = buildCommand || "docker build -t starpak-app .";
12569
+ startCommand = startCommand || "docker run starpak-app";
12536
12570
  }
12537
12571
  if (types.includes("Makefile") && !buildCommand) {
12538
12572
  if (!runtimes.length) runtimes.push("system");
package/package.json CHANGED
@@ -1,15 +1,16 @@
1
1
  {
2
2
  "name": "starpak",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "private": false,
5
5
  "type": "module",
6
- "description": "智能应用部署工具 — cd 进去,剩下的自动完成",
6
+ "description": "Universal package manager, but not just packages! — cd in, the rest is automatic",
7
7
  "bin": {
8
8
  "starpak": "./cli/dist/index.cjs"
9
9
  },
10
10
  "files": [
11
11
  "cli/dist/",
12
- "README.md"
12
+ "README.md",
13
+ "README.zh.md"
13
14
  ],
14
15
  "preferGlobal": true,
15
16
  "engines": {
@@ -28,8 +29,7 @@
28
29
  "scripts": {
29
30
  "prepublish": "npm run build",
30
31
  "build": "tsup --config cli/tsup.config.ts",
31
- "dev": "tsx cli/index.ts",
32
- "postinstall": "node -e ''"
32
+ "dev": "tsx cli/index.ts"
33
33
  },
34
34
  "dependencies": {
35
35
  "cli-progress": "^3.12.0",