@pmaddire/gcie 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 +2 -1
- package/SETUP_ANY_REPO.md +2 -2
- package/bin/gcie.js +53 -13
- package/cli/app.py +1 -1
- package/cli/commands/setup.py +72 -72
- package/package.json +1 -1
- /package/{AGENT_USAGE.md → GCIE_USAGE.md} +0 -0
package/README.md
CHANGED
|
@@ -49,7 +49,7 @@ cost of sending full repo surfaces to the model.
|
|
|
49
49
|
Use this when you want a fast drop-in setup for coding agents.
|
|
50
50
|
|
|
51
51
|
1. Install GCIE CLI in the target repo (via your preferred method: npm link, local wrapper, or direct Python module).
|
|
52
|
-
2. Copy [
|
|
52
|
+
2. Copy [GCIE_USAGE.md](c:\GBCRSS\GCIE_USAGE.md) into the target repo root.
|
|
53
53
|
3. Run one index pass:
|
|
54
54
|
- `gcie.cmd index .`
|
|
55
55
|
4. Start using adaptive retrieval immediately:
|
|
@@ -105,6 +105,7 @@ npx gcie@latest
|
|
|
105
105
|
```
|
|
106
106
|
|
|
107
107
|
This runs `gcie setup .` in the current repo by default.
|
|
108
|
+
If Python deps are missing, GCIE now bootstraps a local package venv and installs required runtime dependencies automatically on first run.
|
|
108
109
|
|
|
109
110
|
Optional setup flags are passed through:
|
|
110
111
|
|
package/SETUP_ANY_REPO.md
CHANGED
|
@@ -43,7 +43,7 @@ Re-run indexing after major structural changes.
|
|
|
43
43
|
|
|
44
44
|
## 3) Add Agent Workflow File
|
|
45
45
|
|
|
46
|
-
Copy `
|
|
46
|
+
Copy `GCIE_USAGE.md` from GCIE into the target repo root.
|
|
47
47
|
|
|
48
48
|
## 4) Start With Portable Defaults
|
|
49
49
|
|
|
@@ -51,7 +51,7 @@ Copy `AGENT_USAGE.md` from GCIE into the target repo root.
|
|
|
51
51
|
gcie.cmd context . "<task>" --intent <edit|debug|refactor|explore> --budget auto
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
Then apply the adaptive loop in `
|
|
54
|
+
Then apply the adaptive loop in `GCIE_USAGE.md` if must-have coverage is incomplete.
|
|
55
55
|
|
|
56
56
|
## 5) Use Adaptive Mode Routing
|
|
57
57
|
|
package/bin/gcie.js
CHANGED
|
@@ -5,19 +5,36 @@ const { spawnSync } = require("child_process");
|
|
|
5
5
|
const { existsSync } = require("fs");
|
|
6
6
|
const { join, resolve, delimiter } = require("path");
|
|
7
7
|
|
|
8
|
-
function
|
|
8
|
+
function run(cmd, args, env, stdio = "inherit") {
|
|
9
|
+
return spawnSync(cmd, args, { stdio, env });
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function resolveVenvPython(gcieRoot) {
|
|
9
13
|
const winVenv = join(gcieRoot, ".venv", "Scripts", "python.exe");
|
|
10
14
|
const nixVenv = join(gcieRoot, ".venv", "bin", "python");
|
|
11
|
-
|
|
12
15
|
if (existsSync(winVenv)) return winVenv;
|
|
13
16
|
if (existsSync(nixVenv)) return nixVenv;
|
|
14
|
-
|
|
15
17
|
return null;
|
|
16
18
|
}
|
|
17
19
|
|
|
18
|
-
function
|
|
19
|
-
const
|
|
20
|
-
|
|
20
|
+
function createVenv(gcieRoot, env) {
|
|
21
|
+
const venvDir = join(gcieRoot, ".venv");
|
|
22
|
+
|
|
23
|
+
let r = run("py", ["-3", "-m", "venv", venvDir], env, "pipe");
|
|
24
|
+
if (r.status === 0) return true;
|
|
25
|
+
|
|
26
|
+
r = run("python", ["-m", "venv", venvDir], env, "pipe");
|
|
27
|
+
return r.status === 0;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function installDeps(venvPython, env) {
|
|
31
|
+
const deps = ["typer", "networkx", "GitPython"];
|
|
32
|
+
const r = run(venvPython, ["-m", "pip", "install", "--disable-pip-version-check", "--quiet", ...deps], env);
|
|
33
|
+
return r.status === 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function runCli(pythonCmd, cliArgs, env) {
|
|
37
|
+
return run(pythonCmd, ["-m", "cli.app", ...cliArgs], env);
|
|
21
38
|
}
|
|
22
39
|
|
|
23
40
|
function main() {
|
|
@@ -30,16 +47,39 @@ function main() {
|
|
|
30
47
|
const env = { ...process.env };
|
|
31
48
|
env.PYTHONPATH = env.PYTHONPATH ? `${gcieRoot}${delimiter}${env.PYTHONPATH}` : gcieRoot;
|
|
32
49
|
|
|
33
|
-
|
|
34
|
-
if (venvPython) {
|
|
35
|
-
|
|
50
|
+
let venvPython = resolveVenvPython(gcieRoot);
|
|
51
|
+
if (!venvPython) {
|
|
52
|
+
console.error("[GCIE] No local venv found. Bootstrapping Python environment...");
|
|
53
|
+
if (!createVenv(gcieRoot, env)) {
|
|
54
|
+
console.error("No Python interpreter found. Install Python 3.11+ and retry.");
|
|
55
|
+
process.exit(1);
|
|
56
|
+
}
|
|
57
|
+
venvPython = resolveVenvPython(gcieRoot);
|
|
58
|
+
if (!venvPython) {
|
|
59
|
+
console.error("[GCIE] Failed to create .venv.");
|
|
60
|
+
process.exit(1);
|
|
61
|
+
}
|
|
62
|
+
if (!installDeps(venvPython, env)) {
|
|
63
|
+
console.error("[GCIE] Failed to install Python dependencies (typer, networkx, GitPython).");
|
|
64
|
+
process.exit(1);
|
|
65
|
+
}
|
|
36
66
|
}
|
|
37
67
|
|
|
38
|
-
|
|
39
|
-
if (
|
|
68
|
+
let result = runCli(venvPython, cliArgs, env);
|
|
69
|
+
if (result.status === 0) {
|
|
70
|
+
process.exit(0);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const stderr = (result.stderr || "").toString();
|
|
74
|
+
if (stderr.includes("No module named") || stderr.includes("ModuleNotFoundError")) {
|
|
75
|
+
console.error("[GCIE] Missing Python deps detected. Installing required dependencies...");
|
|
76
|
+
if (installDeps(venvPython, env)) {
|
|
77
|
+
result = runCli(venvPython, cliArgs, env);
|
|
78
|
+
process.exit(result.status || 0);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
40
81
|
|
|
41
|
-
|
|
42
|
-
process.exit(1);
|
|
82
|
+
process.exit(result.status || 1);
|
|
43
83
|
}
|
|
44
84
|
|
|
45
85
|
main();
|
package/cli/app.py
CHANGED
|
@@ -127,7 +127,7 @@ def context_slices_cmd(
|
|
|
127
127
|
def setup_cmd(
|
|
128
128
|
path: str = typer.Argument("."),
|
|
129
129
|
force: bool = typer.Option(False, "--force", help="Overwrite existing setup files"),
|
|
130
|
-
no_agent_usage: bool = typer.Option(False, "--no-agent-usage", help="Do not copy
|
|
130
|
+
no_agent_usage: bool = typer.Option(False, "--no-agent-usage", help="Do not copy GCIE_USAGE.md"),
|
|
131
131
|
no_setup_doc: bool = typer.Option(False, "--no-setup-doc", help="Do not copy SETUP_ANY_REPO.md"),
|
|
132
132
|
no_index: bool = typer.Option(False, "--no-index", help="Skip initial indexing pass"),
|
|
133
133
|
) -> None:
|
package/cli/commands/setup.py
CHANGED
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
"""One-command repository setup for GCIE."""
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
from pathlib import Path
|
|
6
|
-
|
|
7
|
-
from context.architecture_bootstrap import ensure_initialized
|
|
8
|
-
|
|
9
|
-
from .index import run_index
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def _repo_root() -> Path:
|
|
13
|
-
return Path(__file__).resolve().parents[2]
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
def _copy_if_needed(source: Path, target: Path, *, force: bool) -> str:
|
|
17
|
-
if not source.exists():
|
|
18
|
-
return "source_missing"
|
|
19
|
-
if target.exists() and not force:
|
|
20
|
-
return "skipped_existing"
|
|
21
|
-
target.parent.mkdir(parents=True, exist_ok=True)
|
|
22
|
-
target.write_text(source.read_text(encoding="utf-8"), encoding="utf-8")
|
|
23
|
-
return "written"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
def run_setup(
|
|
27
|
-
path: str,
|
|
28
|
-
*,
|
|
29
|
-
force: bool = False,
|
|
30
|
-
include_agent_usage: bool = True,
|
|
31
|
-
include_setup_doc: bool = True,
|
|
32
|
-
run_index_pass: bool = True,
|
|
33
|
-
) -> dict:
|
|
34
|
-
"""Initialize a repository so GCIE can be used immediately."""
|
|
35
|
-
target = Path(path).resolve()
|
|
36
|
-
target.mkdir(parents=True, exist_ok=True)
|
|
37
|
-
|
|
38
|
-
config = ensure_initialized(target)
|
|
39
|
-
gcie_dir = target / ".gcie"
|
|
40
|
-
|
|
41
|
-
status: dict[str, object] = {
|
|
42
|
-
"repo": target.as_posix(),
|
|
43
|
-
"gcie_dir": gcie_dir.as_posix(),
|
|
44
|
-
"architecture_initialized": True,
|
|
45
|
-
"files": {},
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
source_root = _repo_root()
|
|
49
|
-
copied: dict[str, str] = {}
|
|
50
|
-
|
|
51
|
-
if include_agent_usage:
|
|
52
|
-
copied["
|
|
53
|
-
source_root / "
|
|
54
|
-
target / "
|
|
55
|
-
force=force,
|
|
56
|
-
)
|
|
57
|
-
|
|
58
|
-
if include_setup_doc:
|
|
59
|
-
copied["SETUP_ANY_REPO.md"] = _copy_if_needed(
|
|
60
|
-
source_root / "SETUP_ANY_REPO.md",
|
|
61
|
-
target / "SETUP_ANY_REPO.md",
|
|
62
|
-
force=force,
|
|
63
|
-
)
|
|
64
|
-
|
|
65
|
-
status["files"] = copied
|
|
66
|
-
status["context_config"] = config
|
|
67
|
-
|
|
68
|
-
if run_index_pass:
|
|
69
|
-
status["index"] = run_index(target.as_posix())
|
|
70
|
-
else:
|
|
71
|
-
status["index"] = {"skipped": True}
|
|
72
|
-
|
|
1
|
+
"""One-command repository setup for GCIE."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
from context.architecture_bootstrap import ensure_initialized
|
|
8
|
+
|
|
9
|
+
from .index import run_index
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _repo_root() -> Path:
|
|
13
|
+
return Path(__file__).resolve().parents[2]
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _copy_if_needed(source: Path, target: Path, *, force: bool) -> str:
|
|
17
|
+
if not source.exists():
|
|
18
|
+
return "source_missing"
|
|
19
|
+
if target.exists() and not force:
|
|
20
|
+
return "skipped_existing"
|
|
21
|
+
target.parent.mkdir(parents=True, exist_ok=True)
|
|
22
|
+
target.write_text(source.read_text(encoding="utf-8"), encoding="utf-8")
|
|
23
|
+
return "written"
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def run_setup(
|
|
27
|
+
path: str,
|
|
28
|
+
*,
|
|
29
|
+
force: bool = False,
|
|
30
|
+
include_agent_usage: bool = True,
|
|
31
|
+
include_setup_doc: bool = True,
|
|
32
|
+
run_index_pass: bool = True,
|
|
33
|
+
) -> dict:
|
|
34
|
+
"""Initialize a repository so GCIE can be used immediately."""
|
|
35
|
+
target = Path(path).resolve()
|
|
36
|
+
target.mkdir(parents=True, exist_ok=True)
|
|
37
|
+
|
|
38
|
+
config = ensure_initialized(target)
|
|
39
|
+
gcie_dir = target / ".gcie"
|
|
40
|
+
|
|
41
|
+
status: dict[str, object] = {
|
|
42
|
+
"repo": target.as_posix(),
|
|
43
|
+
"gcie_dir": gcie_dir.as_posix(),
|
|
44
|
+
"architecture_initialized": True,
|
|
45
|
+
"files": {},
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
source_root = _repo_root()
|
|
49
|
+
copied: dict[str, str] = {}
|
|
50
|
+
|
|
51
|
+
if include_agent_usage:
|
|
52
|
+
copied["GCIE_USAGE.md"] = _copy_if_needed(
|
|
53
|
+
source_root / "GCIE_USAGE.md",
|
|
54
|
+
target / "GCIE_USAGE.md",
|
|
55
|
+
force=force,
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
if include_setup_doc:
|
|
59
|
+
copied["SETUP_ANY_REPO.md"] = _copy_if_needed(
|
|
60
|
+
source_root / "SETUP_ANY_REPO.md",
|
|
61
|
+
target / "SETUP_ANY_REPO.md",
|
|
62
|
+
force=force,
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
status["files"] = copied
|
|
66
|
+
status["context_config"] = config
|
|
67
|
+
|
|
68
|
+
if run_index_pass:
|
|
69
|
+
status["index"] = run_index(target.as_posix())
|
|
70
|
+
else:
|
|
71
|
+
status["index"] = {"skipped": True}
|
|
72
|
+
|
|
73
73
|
return status
|
package/package.json
CHANGED
|
File without changes
|