luang-cli 0.3.3 → 0.3.5

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
@@ -151,6 +151,7 @@ CLI API Browser (kamu)
151
151
  | `workspace` | Folder kerja provider (sinkron dashboard), dipakai cwd `--exec` | `luang-cli workspace ~/project` |
152
152
  | `agent start` | Jalankan daemon di **background** (mode auto, log + pid file) | `luang-cli agent start` |
153
153
  | `agent stop\|status\|logs` | Hentikan (SIGTERM) · status (pid/uptime/log) · tail log | `luang-cli agent logs --tail 50` |
154
+ | `start` / `stop` / `logs` | Alias top-level ala PM2 → `agent …` (`status` tetap ringkasan CLI) | `luang-cli start` |
154
155
  | `task list` | Daftar tugas agent (filter status) | `luang-cli task list --status todo` |
155
156
  | `task create` | Buat tugas (butuh izin admin) | `luang-cli task create --title "Refactor auth" --priority high` |
156
157
  | `task status` | Perbarui status + catatan progress | `luang-cli task status TGS-12 in_progress --note "mulai"` |
package/bin/luang-cli.js CHANGED
@@ -20,6 +20,9 @@ Command:
20
20
  telemetry Konsent telemetry on|off|status luang-cli telemetry status
21
21
  workspace Folder kerja provider (sinkron dash) luang-cli workspace [path|--reset]
22
22
  agent Daemon realtime WS + polling tugas luang-cli agent [--exec] · start|stop|status|logs
23
+ start Alias: agent start (background) luang-cli start [--no-auto]
24
+ stop Alias: agent stop luang-cli stop
25
+ logs Alias: agent logs luang-cli logs [--tail 50]
23
26
  models Daftar model AI per provider luang-cli models [provider] [--json]
24
27
  task Kelola tugas (list|create|status) luang-cli task list
25
28
  status Ringkasan CLI (key, tenant, izin) luang-cli status
@@ -278,6 +281,8 @@ function parseArgs(argv) {
278
281
  }
279
282
 
280
283
  function printHelp(topic) {
284
+ // Alias top-level start/stop/logs → dokumentasi di topik agent.
285
+ if (topic === 'start' || topic === 'stop' || topic === 'logs') topic = 'agent';
281
286
  const t = TOPICS[topic || 'help'];
282
287
  if (!t) {
283
288
  console.error(`❌ Command tidak dikenal: ${topic}`);
@@ -321,6 +326,12 @@ async function main() {
321
326
  return c.cmdTelemetry(rt, args);
322
327
  case 'workspace':
323
328
  return c.cmdWorkspace(rt, args);
329
+ // Alias gaya PM2: start/stop/logs top-level → subcommand agent.
330
+ // (status TIDAK dialias — tetap ringkasan CLI; pakai `agent status`.)
331
+ case 'start':
332
+ case 'stop':
333
+ case 'logs':
334
+ return ag.cmdAgent(rt, { ...args, pos: ['agent', cmd] });
324
335
  case 'agent':
325
336
  return ag.cmdAgent(rt, args);
326
337
  case 'models':
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "luang-cli",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "description": "CLI Agent Orchestration Luang — login device flow, sinkronisasi provider AI, daemon tugas, dan manajemen task dari terminal. Zero-dependency, Node >= 18.",
5
5
  "license": "MIT",
6
6
  "bin": {
package/test/run-e2e.js CHANGED
@@ -781,6 +781,35 @@ async function scenarioWorkspace() {
781
781
  console.log(' ✅ Skenario workspace selesai');
782
782
  }
783
783
 
784
+ // ── Skenario 9: alias top-level start/stop/logs (+ help) ──
785
+ async function scenarioAliases() {
786
+ console.log('\n[9] alias start/stop/logs → subcommand agent (+ help start)');
787
+ const home = mkFakeHome('alias');
788
+ writeJson(path.join(home, '.luang-cli', 'config.json'), {
789
+ api_url: 'http://127.0.0.1:9',
790
+ app_url: 'http://127.0.0.1',
791
+ key: 'lk_test_e2e_alias',
792
+ default_provider: null,
793
+ providers: {},
794
+ });
795
+ const env = { ...daemonEnv(home), LUANG_HEARTBEAT_SEC: undefined };
796
+
797
+ // stop/logs tanpa daemon → pesan ramah, exit 0 (bukti delegasi ke cmdAgent jalan)
798
+ let r = runCli(env, ['stop']);
799
+ assert(r.code === 0 && r.stdout.includes('Agent tidak berjalan'), 'alias stop → agent stop (tidak berjalan, exit 0)');
800
+ r = runCli(env, ['logs']);
801
+ assert(r.code === 0 && r.stdout.includes('Log belum ada'), 'alias logs → agent logs (belum ada, exit 0)');
802
+ // help start → topik agent
803
+ r = runCli(env, ['help', 'start']);
804
+ assert(r.code === 0 && r.stdout.includes('luang-cli agent'), 'help start → menampilkan topik agent');
805
+ // status TIDAK dialias (tetap ringkasan CLI)
806
+ r = runCli(env, ['status']);
807
+ assert(r.code === 0 && r.stdout.includes('Status luang-cli'), 'status tetap ringkasan CLI (bukan agent status)');
808
+
809
+ passCount += 1;
810
+ console.log(' ✅ Skenario alias selesai');
811
+ }
812
+
784
813
  // ── main ──
785
814
  async function main() {
786
815
  console.log(`E2E luang-cli — fakir HOME: ${baseTmp}`);
@@ -792,6 +821,7 @@ async function main() {
792
821
  await scenarioAgentLifecycle();
793
822
  await scenarioModels();
794
823
  await scenarioWorkspace();
824
+ await scenarioAliases();
795
825
  console.log(`\nSEMIUA PASS ✅ (${passCount} assertion)`);
796
826
  }
797
827