@groundctl/cli 0.1.1 → 0.2.0

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.
Files changed (2) hide show
  1. package/dist/index.js +66 -11
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -736,14 +736,40 @@ function timeSince(isoDate) {
736
736
  // src/commands/claim.ts
737
737
  import chalk3 from "chalk";
738
738
  import { randomUUID } from "crypto";
739
- async function claimCommand(featureIdOrName, options) {
740
- const db = await openDb();
741
- const feature = queryOne(
739
+ function findFeature(db, term) {
740
+ return queryOne(
742
741
  db,
743
742
  `SELECT id, name, status FROM features
744
- WHERE id = ? OR name = ? OR name LIKE ?`,
745
- [featureIdOrName, featureIdOrName, `%${featureIdOrName}%`]
743
+ WHERE id = ? OR name = ?
744
+ UNION ALL
745
+ SELECT id, name, status FROM features
746
+ WHERE (id LIKE ? OR name LIKE ?)
747
+ AND id != ? AND name != ?
748
+ UNION ALL
749
+ SELECT id, name, status FROM features
750
+ WHERE (id LIKE ? OR name LIKE ?)
751
+ AND id NOT LIKE ? AND name NOT LIKE ?
752
+ AND id != ? AND name != ?
753
+ LIMIT 1`,
754
+ [
755
+ term,
756
+ term,
757
+ `${term}%`,
758
+ `${term}%`,
759
+ term,
760
+ term,
761
+ `%${term}%`,
762
+ `%${term}%`,
763
+ `${term}%`,
764
+ `${term}%`,
765
+ term,
766
+ term
767
+ ]
746
768
  );
769
+ }
770
+ async function claimCommand(featureIdOrName, options) {
771
+ const db = await openDb();
772
+ const feature = findFeature(db, featureIdOrName);
747
773
  if (!feature) {
748
774
  console.log(chalk3.red(`
749
775
  Feature "${featureIdOrName}" not found.
@@ -821,12 +847,7 @@ async function claimCommand(featureIdOrName, options) {
821
847
  }
822
848
  async function completeCommand(featureIdOrName) {
823
849
  const db = await openDb();
824
- const feature = queryOne(
825
- db,
826
- `SELECT id, name, status FROM features
827
- WHERE id = ? OR name = ? OR name LIKE ?`,
828
- [featureIdOrName, featureIdOrName, `%${featureIdOrName}%`]
829
- );
850
+ const feature = findFeature(db, featureIdOrName);
830
851
  if (!feature) {
831
852
  console.log(chalk3.red(`
832
853
  Feature "${featureIdOrName}" not found.
@@ -1646,6 +1667,39 @@ async function healthCommand() {
1646
1667
  }
1647
1668
  }
1648
1669
 
1670
+ // src/commands/dashboard.ts
1671
+ import { existsSync as existsSync5 } from "fs";
1672
+ import { join as join7, dirname as dirname2 } from "path";
1673
+ import { fileURLToPath } from "url";
1674
+ import { spawn } from "child_process";
1675
+ import chalk11 from "chalk";
1676
+ var __dirname = dirname2(fileURLToPath(import.meta.url));
1677
+ async function dashboardCommand(options) {
1678
+ const port = options.port ?? "4242";
1679
+ const serverPath = join7(__dirname, "..", "..", "..", "dashboard", "src", "server.js");
1680
+ if (!existsSync5(serverPath)) {
1681
+ console.log(chalk11.red(`
1682
+ Dashboard server not found at: ${serverPath}
1683
+ `));
1684
+ console.log(chalk11.gray(" If running from source: npm run build"));
1685
+ return;
1686
+ }
1687
+ console.log(chalk11.bold(`
1688
+ groundctl dashboard \u2192 http://localhost:${port}
1689
+ `));
1690
+ console.log(chalk11.gray(" Auto-refreshes every 10s. Press Ctrl+C to stop.\n"));
1691
+ const child = spawn(process.execPath, [serverPath], {
1692
+ stdio: "inherit",
1693
+ env: { ...process.env, GROUNDCTL_PORT: port }
1694
+ });
1695
+ child.on("error", (err) => {
1696
+ console.error(chalk11.red(` Error: ${err.message}`));
1697
+ });
1698
+ await new Promise((resolve2) => {
1699
+ child.on("close", () => resolve2());
1700
+ });
1701
+ }
1702
+
1649
1703
  // src/index.ts
1650
1704
  var require2 = createRequire(import.meta.url);
1651
1705
  var pkg = require2("../package.json");
@@ -1670,4 +1724,5 @@ program.command("ingest").description("Parse a transcript and write session data
1670
1724
  );
1671
1725
  program.command("report").description("Generate SESSION_REPORT.md from SQLite").option("-s, --session <id>", "Report for a specific session").option("--all", "Generate report for all sessions").action(reportCommand);
1672
1726
  program.command("health").description("Show product health score").action(healthCommand);
1727
+ program.command("dashboard").description("Start web dashboard on port 4242").option("-p, --port <port>", "Port number", "4242").action(dashboardCommand);
1673
1728
  program.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@groundctl/cli",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Product memory for AI agent builders",
5
5
  "license": "MIT",
6
6
  "bin": {