@groundctl/cli 0.1.0 → 0.1.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/dist/index.js +42 -7
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
4
|
import { Command } from "commander";
|
|
5
|
+
import { createRequire } from "module";
|
|
5
6
|
|
|
6
7
|
// src/commands/init.ts
|
|
7
8
|
import { existsSync as existsSync3, mkdirSync as mkdirSync2, writeFileSync as writeFileSync2, chmodSync, readFileSync as readFileSync3, appendFileSync } from "fs";
|
|
@@ -104,13 +105,42 @@ function applySchema(db) {
|
|
|
104
105
|
}
|
|
105
106
|
|
|
106
107
|
// src/storage/db.ts
|
|
107
|
-
var
|
|
108
|
-
var
|
|
108
|
+
var GLOBAL_DIR = join(homedir(), ".groundctl");
|
|
109
|
+
var GLOBAL_DB_PATH = join(GLOBAL_DIR, "db.sqlite");
|
|
109
110
|
var _db = null;
|
|
110
|
-
var _dbPath =
|
|
111
|
-
|
|
111
|
+
var _dbPath = GLOBAL_DB_PATH;
|
|
112
|
+
var _groundctlDir = GLOBAL_DIR;
|
|
113
|
+
function findProjectDir(startDir) {
|
|
114
|
+
let dir = startDir ?? process.cwd();
|
|
115
|
+
const root = dirname(dir);
|
|
116
|
+
for (let i = 0; i < 10; i++) {
|
|
117
|
+
if (existsSync(join(dir, ".groundctl"))) {
|
|
118
|
+
return join(dir, ".groundctl");
|
|
119
|
+
}
|
|
120
|
+
if (existsSync(join(dir, ".git"))) {
|
|
121
|
+
return join(dir, ".groundctl");
|
|
122
|
+
}
|
|
123
|
+
const parent = dirname(dir);
|
|
124
|
+
if (parent === dir) break;
|
|
125
|
+
dir = parent;
|
|
126
|
+
}
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
async function openDb(explicitPath) {
|
|
112
130
|
if (_db) return _db;
|
|
113
|
-
|
|
131
|
+
let dbPath;
|
|
132
|
+
if (explicitPath) {
|
|
133
|
+
dbPath = explicitPath;
|
|
134
|
+
} else {
|
|
135
|
+
const projectDir = findProjectDir();
|
|
136
|
+
if (projectDir) {
|
|
137
|
+
_groundctlDir = projectDir;
|
|
138
|
+
dbPath = join(projectDir, "db.sqlite");
|
|
139
|
+
} else {
|
|
140
|
+
_groundctlDir = GLOBAL_DIR;
|
|
141
|
+
dbPath = GLOBAL_DB_PATH;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
114
144
|
_dbPath = dbPath;
|
|
115
145
|
const dir = dirname(dbPath);
|
|
116
146
|
if (!existsSync(dir)) {
|
|
@@ -380,11 +410,14 @@ function parseProjectStateMd(content) {
|
|
|
380
410
|
section = trimmed.toLowerCase();
|
|
381
411
|
continue;
|
|
382
412
|
}
|
|
413
|
+
if (section.includes("decision") || section.includes("session") || section.includes("debt") || section.includes("note")) continue;
|
|
383
414
|
if (!trimmed.startsWith("- ") && !trimmed.startsWith("* ")) continue;
|
|
384
415
|
const item = trimmed.slice(2).trim();
|
|
385
416
|
if (!item || item.length < 3) continue;
|
|
386
417
|
const name = item.split("(")[0].split("\u2192")[0].split("\u2014")[0].trim();
|
|
387
|
-
if (!name || name.length < 3) continue;
|
|
418
|
+
if (!name || name.length < 3 || name.length > 80) continue;
|
|
419
|
+
if (/^\d{4}-\d{2}-\d{2}/.test(name)) continue;
|
|
420
|
+
if (name.split(" ").length > 8) continue;
|
|
388
421
|
let status = "pending";
|
|
389
422
|
let priority = "medium";
|
|
390
423
|
if (section.includes("built") || section.includes("done") || section.includes("complete")) {
|
|
@@ -1614,8 +1647,10 @@ async function healthCommand() {
|
|
|
1614
1647
|
}
|
|
1615
1648
|
|
|
1616
1649
|
// src/index.ts
|
|
1650
|
+
var require2 = createRequire(import.meta.url);
|
|
1651
|
+
var pkg = require2("../package.json");
|
|
1617
1652
|
var program = new Command();
|
|
1618
|
-
program.name("groundctl").description("The shared memory your agents and you actually need.").version(
|
|
1653
|
+
program.name("groundctl").description("The shared memory your agents and you actually need.").version(pkg.version);
|
|
1619
1654
|
program.command("init").description("Setup hooks + initial state for the current project").option("--import-from-git", "Bootstrap sessions and features from git history").action((opts) => initCommand({ importFromGit: opts.importFromGit }));
|
|
1620
1655
|
program.command("status").description("Show macro view of the product state").action(statusCommand);
|
|
1621
1656
|
program.command("claim <feature>").description("Reserve a feature for the current session").option("-s, --session <id>", "Session ID (auto-generated if omitted)").action(claimCommand);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@groundctl/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Product memory for AI agent builders",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
"homepage": "https://groundctl.org",
|
|
25
25
|
"repository": {
|
|
26
26
|
"type": "git",
|
|
27
|
-
"url": "git+https://github.com/
|
|
27
|
+
"url": "git+https://github.com/patrickjoubert/groundctl.git"
|
|
28
28
|
},
|
|
29
29
|
"bugs": {
|
|
30
|
-
"url": "https://github.com/
|
|
30
|
+
"url": "https://github.com/patrickjoubert/groundctl/issues"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
33
|
"build": "tsup src/index.ts --format esm --dts --clean",
|