guardian-framework 0.1.75 → 0.1.77

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/cli.js CHANGED
@@ -3197,7 +3197,7 @@ __export(exports_package, {
3197
3197
  bin: () => bin,
3198
3198
  author: () => author
3199
3199
  });
3200
- var name = "guardian-framework", version = "0.1.75", description = "Token-optimized agentic framework scaffolder with pi-first architecture", type = "module", main = "dist/exports.js", exports, types = "dist/exports.d.ts", bin, files, engines, scripts, publishConfig, pi, repository, homepage = "https://github.com/arman-jalili/guardian-framework#readme", bugs, dependencies, devDependencies, keywords, author = "Arman Wolkensteiner-Jalili", license = "MIT", package_default;
3200
+ var name = "guardian-framework", version = "0.1.77", description = "Token-optimized agentic framework scaffolder with pi-first architecture", type = "module", main = "dist/exports.js", exports, types = "dist/exports.d.ts", bin, files, engines, scripts, publishConfig, pi, repository, homepage = "https://github.com/arman-jalili/guardian-framework#readme", bugs, dependencies, devDependencies, keywords, author = "Arman Wolkensteiner-Jalili", license = "MIT", package_default;
3201
3201
  var init_package = __esm(() => {
3202
3202
  exports = {
3203
3203
  ".": {
package/dist/exports.js CHANGED
@@ -1982,7 +1982,7 @@ __export(exports_package, {
1982
1982
  bin: () => bin,
1983
1983
  author: () => author
1984
1984
  });
1985
- var name = "guardian-framework", version = "0.1.75", description = "Token-optimized agentic framework scaffolder with pi-first architecture", type = "module", main = "dist/exports.js", exports, types = "dist/exports.d.ts", bin, files, engines, scripts, publishConfig, pi, repository, homepage = "https://github.com/arman-jalili/guardian-framework#readme", bugs, dependencies, devDependencies, keywords, author = "Arman Wolkensteiner-Jalili", license = "MIT", package_default;
1985
+ var name = "guardian-framework", version = "0.1.77", description = "Token-optimized agentic framework scaffolder with pi-first architecture", type = "module", main = "dist/exports.js", exports, types = "dist/exports.d.ts", bin, files, engines, scripts, publishConfig, pi, repository, homepage = "https://github.com/arman-jalili/guardian-framework#readme", bugs, dependencies, devDependencies, keywords, author = "Arman Wolkensteiner-Jalili", license = "MIT", package_default;
1986
1986
  var init_package = __esm(() => {
1987
1987
  exports = {
1988
1988
  ".": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "guardian-framework",
3
- "version": "0.1.75",
3
+ "version": "0.1.77",
4
4
  "description": "Token-optimized agentic framework scaffolder with pi-first architecture",
5
5
  "type": "module",
6
6
  "main": "dist/exports.js",
@@ -81,6 +81,39 @@ export function glabEncodePath(rawPath: string): string {
81
81
  return encodeURIComponent(rawPath);
82
82
  }
83
83
 
84
+ /**
85
+ * Get the appropriate GitLab remote URL based on the configured protocol.
86
+ * Supports SSH (git@) and HTTPS protocols as configured in glab CLI.
87
+ */
88
+ export function getGlabRemoteUrl(repository: string): string {
89
+ // Try to detect protocol from glab config
90
+ try {
91
+ const protocol = execSync("glab config get git_protocol 2>/dev/null", {
92
+ encoding: "utf-8",
93
+ timeout: 10_000,
94
+ }).trim();
95
+ if (protocol === "ssh") {
96
+ // SSH format: git@gitlab.com:group/subgroup/project.git
97
+ // Detect self-hosted instance for the host part
98
+ let host = "gitlab.com";
99
+ try {
100
+ const uri = execSync("glab config get gitlab_uri 2>/dev/null", {
101
+ encoding: "utf-8",
102
+ timeout: 10_000,
103
+ }).trim();
104
+ if (uri) {
105
+ // Extract host from URI: "https://gitlab.example.com" -> "gitlab.example.com"
106
+ host = uri.replace(/^https?:\/\//, "").replace(/\/+$/, "");
107
+ }
108
+ } catch { /* use default */ }
109
+ return `git@${host}:${repository}.git`;
110
+ }
111
+ } catch { /* fall through to HTTPS */ }
112
+ // Default to HTTPS
113
+ const baseUrl = getGitBaseUrl("glab");
114
+ return `${baseUrl}/${repository}.git`;
115
+ }
116
+
84
117
  /**
85
118
  * Get forge base URL. For GitLab, detects self-hosted instances via glab config.
86
119
  */
@@ -11,6 +11,7 @@ import {
11
11
  runScript as adapterRunScript,
12
12
  verifyForgeAccess,
13
13
  glabEncodePath,
14
+ getGlabRemoteUrl,
14
15
  } from "./forge-adapter.ts";
15
16
  // ── Constants ──
16
17
 
@@ -43,16 +44,17 @@ function execSyncWithRetry(
43
44
  cwd: string,
44
45
  opts: { timeout?: number; maxRetries?: number; delayMs?: number } = {},
45
46
  ): { exitCode: number; stdout: string } {
46
- const maxRetries = opts.maxRetries ?? 2;
47
- const delayMs = opts.delayMs ?? 2000;
47
+ const maxRetries = opts.maxRetries ?? 4;
48
+ const delayMs = opts.delayMs ?? 5000;
48
49
  let lastError = "";
49
50
 
50
51
  for (let attempt = 0; attempt <= maxRetries; attempt++) {
51
52
  if (attempt > 0) {
52
- const wait = delayMs * Math.pow(2, attempt - 1);
53
- const waitSec = Math.ceil(wait / 1000);
53
+ const wait = delayMs * Math.pow(1.5, attempt - 1);
54
+ const waitMs = Math.min(wait, 30_000);
55
+ const waitSec = Math.ceil(waitMs / 1000);
54
56
  try {
55
- execFileSync("sleep", [String(waitSec)], { cwd, timeout: 30_000, encoding: "utf-8" });
57
+ execFileSync("sleep", [String(waitSec)], { cwd, timeout: 60_000, encoding: "utf-8" });
56
58
  } catch { /* ignore */ }
57
59
  }
58
60
  try {
@@ -198,7 +200,6 @@ export function ensureRemoteRepo(
198
200
  }
199
201
 
200
202
  // GitLab path — detect self-hosted base URL from glab config
201
- const glabBaseUrl = getGitBaseUrl("glab");
202
203
 
203
204
  // Split repository path into group + project name for glab CLI
204
205
  const parts = repository.split("/");
@@ -215,6 +216,7 @@ export function ensureRemoteRepo(
215
216
  `glab repo create "${repository}" --private --description "Epic: ${epicName}" 2>&1`,
216
217
  );
217
218
 
219
+ let projectId = "";
218
220
  if (createResult.exitCode !== 0) {
219
221
  // Repo may already exist — verify via API before giving up
220
222
  const encodedPath = glabEncodePath(repository);
@@ -226,11 +228,35 @@ export function ensureRemoteRepo(
226
228
  console.warn(`Failed to create or find GitLab project: ${createResult.stdout}`);
227
229
  return "";
228
230
  }
229
- console.warn(`GitLab project already exists, connecting to it.`);
231
+ projectId = viewResult.stdout.trim();
232
+ console.warn(`GitLab project already exists (id=${projectId}), connecting to it.`);
233
+ } else {
234
+ // Project was just created — wait for GitLab to provision it
235
+ // (new projects can take 10-30s before accepting issues)
236
+ const encodedPath = glabEncodePath(repository);
237
+ console.warn(`Waiting for GitLab project to be ready...`);
238
+ for (let attempt = 0; attempt < 12; attempt++) {
239
+ const checkResult = runScript(
240
+ cwd,
241
+ `glab api "projects/${encodedPath}" --method GET 2>/dev/null | jq -r '.id // empty'`,
242
+ );
243
+ if (checkResult.exitCode === 0 && checkResult.stdout.trim()) {
244
+ projectId = checkResult.stdout.trim();
245
+ console.warn(`GitLab project ready (id=${projectId})`);
246
+ break;
247
+ }
248
+ if (attempt < 11) {
249
+ try { execFileSync("sleep", ["5"], { cwd, timeout: 30_000 }); } catch { /* ignore */ }
250
+ }
251
+ }
252
+ if (!projectId) {
253
+ console.warn(`GitLab project not ready after 60s, continuing anyway.`);
254
+ }
230
255
  }
256
+
231
257
  runScript(cwd, "git remote remove origin 2>/dev/null");
232
- const httpsUrl = `${glabBaseUrl}/${repository}.git`;
233
- runScript(cwd, `git remote add origin "${httpsUrl}"`);
258
+ const remoteUrl = getGlabRemoteUrl(repository);
259
+ runScript(cwd, `git remote add origin "${remoteUrl}"`);
234
260
  return repository;
235
261
  }
236
262
 
@@ -1,5 +1,5 @@
1
1
  {
2
- "timestamp": "2026-07-13T12:43:57Z",
2
+ "timestamp": "2026-07-13T13:10:35Z",
3
3
  "mode": "all",
4
4
  "stages_run": [],
5
5
  "summary": {