@scheduler-systems/gal-run 0.0.407 → 0.0.408
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.cjs +1070 -925
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3970,7 +3970,7 @@ var cliVersion, defaultApiUrl, BUILD_CONSTANTS, constants_default;
|
|
|
3970
3970
|
var init_constants = __esm({
|
|
3971
3971
|
"src/constants.ts"() {
|
|
3972
3972
|
"use strict";
|
|
3973
|
-
cliVersion = true ? "0.0.
|
|
3973
|
+
cliVersion = true ? "0.0.408" : "0.0.0-dev";
|
|
3974
3974
|
defaultApiUrl = true ? "https://api.gal.run" : "http://localhost:3000";
|
|
3975
3975
|
BUILD_CONSTANTS = Object.freeze([cliVersion, defaultApiUrl]);
|
|
3976
3976
|
constants_default = BUILD_CONSTANTS;
|
|
@@ -4880,7 +4880,7 @@ function detectEnvironment() {
|
|
|
4880
4880
|
return "dev";
|
|
4881
4881
|
}
|
|
4882
4882
|
try {
|
|
4883
|
-
const version2 = true ? "0.0.
|
|
4883
|
+
const version2 = true ? "0.0.408" : void 0;
|
|
4884
4884
|
if (version2 && version2.includes("-local")) {
|
|
4885
4885
|
return "dev";
|
|
4886
4886
|
}
|
|
@@ -5056,8 +5056,8 @@ async function promptErrorFeedback(command, error3) {
|
|
|
5056
5056
|
output: process.stdout
|
|
5057
5057
|
});
|
|
5058
5058
|
const question = (prompt2) => {
|
|
5059
|
-
return new Promise((
|
|
5060
|
-
rl.question(prompt2,
|
|
5059
|
+
return new Promise((resolve11) => {
|
|
5060
|
+
rl.question(prompt2, resolve11);
|
|
5061
5061
|
});
|
|
5062
5062
|
};
|
|
5063
5063
|
try {
|
|
@@ -5114,8 +5114,8 @@ async function promptSessionFeedback() {
|
|
|
5114
5114
|
output: process.stdout
|
|
5115
5115
|
});
|
|
5116
5116
|
const question = (prompt2) => {
|
|
5117
|
-
return new Promise((
|
|
5118
|
-
rl.question(prompt2,
|
|
5117
|
+
return new Promise((resolve11) => {
|
|
5118
|
+
rl.question(prompt2, resolve11);
|
|
5119
5119
|
});
|
|
5120
5120
|
};
|
|
5121
5121
|
try {
|
|
@@ -5249,7 +5249,7 @@ function getId() {
|
|
|
5249
5249
|
}
|
|
5250
5250
|
function getCliVersion() {
|
|
5251
5251
|
try {
|
|
5252
|
-
return true ? "0.0.
|
|
5252
|
+
return true ? "0.0.408" : "0.0.0-dev";
|
|
5253
5253
|
} catch {
|
|
5254
5254
|
return "0.0.0-dev";
|
|
5255
5255
|
}
|
|
@@ -6400,10 +6400,10 @@ async function promptUser() {
|
|
|
6400
6400
|
input: process.stdin,
|
|
6401
6401
|
output: process.stdout
|
|
6402
6402
|
});
|
|
6403
|
-
return new Promise((
|
|
6403
|
+
return new Promise((resolve11) => {
|
|
6404
6404
|
rl.question("Do you accept? (yes/no): ", (answer) => {
|
|
6405
6405
|
rl.close();
|
|
6406
|
-
|
|
6406
|
+
resolve11(answer.trim().toLowerCase() === "yes" || answer.trim().toLowerCase() === "y");
|
|
6407
6407
|
});
|
|
6408
6408
|
});
|
|
6409
6409
|
}
|
|
@@ -7745,12 +7745,12 @@ function getFeatureFlags() {
|
|
|
7745
7745
|
let isPartnerFromApi = false;
|
|
7746
7746
|
if (!isInternalEnv) {
|
|
7747
7747
|
try {
|
|
7748
|
-
const { readFileSync:
|
|
7749
|
-
const { join:
|
|
7750
|
-
const { homedir:
|
|
7751
|
-
const configPath =
|
|
7752
|
-
if (
|
|
7753
|
-
const config2 = JSON.parse(
|
|
7748
|
+
const { readFileSync: readFileSync42, existsSync: existsSync47 } = require("fs");
|
|
7749
|
+
const { join: join51 } = require("path");
|
|
7750
|
+
const { homedir: homedir27 } = require("os");
|
|
7751
|
+
const configPath = join51(homedir27(), ".gal", "config.json");
|
|
7752
|
+
if (existsSync47(configPath)) {
|
|
7753
|
+
const config2 = JSON.parse(readFileSync42(configPath, "utf-8"));
|
|
7754
7754
|
const cacheAge = Date.now() - (config2.flagsCachedAt || config2.internalOrgsCheckedAt || 0);
|
|
7755
7755
|
if (cacheAge < CACHE_MAX_AGE_MS) {
|
|
7756
7756
|
const userOrgs = config2.orgMemberships || [];
|
|
@@ -7941,7 +7941,7 @@ var init_feature_flags2 = __esm({
|
|
|
7941
7941
|
init_src();
|
|
7942
7942
|
COMMAND_CATEGORIES = {
|
|
7943
7943
|
// Core convenience package (always visible)
|
|
7944
|
-
core: ["auth", "sync", "mcp", "feedback", "update", "hooks", "status", "discover", "approve", "approved-config", "propose", "workspace", "fetch", "join", "scan", "memory", "policy", "install"],
|
|
7944
|
+
core: ["auth", "sync", "mcp", "feedback", "update", "hooks", "init", "status", "discover", "approve", "approved-config", "propose", "workspace", "fetch", "join", "scan", "memory", "policy", "install"],
|
|
7945
7945
|
// Internal development commands (requires org with internal audienceTier; GAL_INTERNAL=true is dev/test override only)
|
|
7946
7946
|
internal: [
|
|
7947
7947
|
"admin",
|
|
@@ -14412,60 +14412,7 @@ var init_capability_analyzer = __esm({
|
|
|
14412
14412
|
message: "The prompt includes a production deployment operation. Production deploys require elevated cloud permissions and may impact live users.",
|
|
14413
14413
|
recommendation: "Ensure the session has appropriate GCP / cloud IAM roles. Run a dry-run or staging deploy first to validate the change. Verify that required secrets (GCP_SA_KEY, etc.) are available to the runner."
|
|
14414
14414
|
},
|
|
14415
|
-
// 5.
|
|
14416
|
-
{
|
|
14417
|
-
ruleId: "BROWSER_PROFILE_REQUIREMENT",
|
|
14418
|
-
category: "browser_profiles",
|
|
14419
|
-
severity: "warning",
|
|
14420
|
-
patterns: [
|
|
14421
|
-
/\bbrowser\s+profile(s)?\b/i,
|
|
14422
|
-
/\bbrowser_profile_ids\b/i,
|
|
14423
|
-
/\bstorage\s*state\b/i,
|
|
14424
|
-
/playwright.{0,40}(auth|profile|storage|cookie|session)/i,
|
|
14425
|
-
/console\.(firebase|cloud)\.google\.com/i,
|
|
14426
|
-
/(attach|inject|reuse|use).{0,40}browser.{0,30}profile/i
|
|
14427
|
-
],
|
|
14428
|
-
title: "Browser profile requirement detected",
|
|
14429
|
-
message: "The prompt indicates browser automation that may require persisted authenticated browser state. Without an active browser profile, UI/console operations can fail with login or permission errors.",
|
|
14430
|
-
recommendation: "Ensure approved browser profile IDs are available for the target account and passed to dispatch. Prefer pre-seeded profiles for production consoles instead of interactive login inside the run."
|
|
14431
|
-
},
|
|
14432
|
-
// 6. Cloud authentication (GCP/Firebase)
|
|
14433
|
-
{
|
|
14434
|
-
ruleId: "CLOUD_AUTH_REQUIREMENT",
|
|
14435
|
-
category: "cloud_auth",
|
|
14436
|
-
severity: "warning",
|
|
14437
|
-
patterns: [
|
|
14438
|
-
/\bgcloud\s+auth\b/i,
|
|
14439
|
-
/\bgcloud-adc\b/i,
|
|
14440
|
-
/\bgoogle_application_credentials\b/i,
|
|
14441
|
-
/\bgoogle\s+application\s+credentials\b/i,
|
|
14442
|
-
/\bworkload\s+identity(\s+federation)?\b/i,
|
|
14443
|
-
/\bfirebase\s+(admin|auth|cli|login)\b/i,
|
|
14444
|
-
/\bservice\s+account\b/i,
|
|
14445
|
-
/\bcloud\s+iam\b/i
|
|
14446
|
-
],
|
|
14447
|
-
title: "Cloud authentication requirement detected",
|
|
14448
|
-
message: "The prompt references GCP/Firebase authentication or cloud identity setup. Runs without valid cloud auth often fail at runtime with permission or credential errors.",
|
|
14449
|
-
recommendation: "Verify that cloud auth is available before dispatch (for example Workload Identity or approved auth refs). Confirm the target account has the required IAM roles for the requested operation."
|
|
14450
|
-
},
|
|
14451
|
-
// 7. Approved environment secrets/auth refs
|
|
14452
|
-
{
|
|
14453
|
-
ruleId: "ENVIRONMENT_CONFIG_REQUIREMENT",
|
|
14454
|
-
category: "environment_config",
|
|
14455
|
-
severity: "warning",
|
|
14456
|
-
patterns: [
|
|
14457
|
-
/\benvironmentconfig\b/i,
|
|
14458
|
-
/\benvironment\s+config(uration)?\b/i,
|
|
14459
|
-
/\bapproved\s+environment\b/i,
|
|
14460
|
-
/environment\.(secrets|auth)/i,
|
|
14461
|
-
/secrets\/[a-z0-9._-]+/i,
|
|
14462
|
-
/\b(secret|auth)\s+ref(erence)?s?\b/i
|
|
14463
|
-
],
|
|
14464
|
-
title: "Approved environment configuration requirement detected",
|
|
14465
|
-
message: "The prompt references environment-level secrets or auth references. If approved environment configuration is missing, dispatch can appear healthy but fail during execution.",
|
|
14466
|
-
recommendation: "Confirm approved environment config includes all required secret/auth refs before dispatch. Block or defer dispatch when required refs are missing."
|
|
14467
|
-
},
|
|
14468
|
-
// 8. npm publish
|
|
14415
|
+
// 5. npm publish
|
|
14469
14416
|
{
|
|
14470
14417
|
ruleId: "NPM_PUBLISH",
|
|
14471
14418
|
category: "npm_publish",
|
|
@@ -14484,7 +14431,7 @@ var init_capability_analyzer = __esm({
|
|
|
14484
14431
|
message: "The prompt includes an npm publish operation. Publishing requires a valid npm token with publish rights to the target package scope.",
|
|
14485
14432
|
recommendation: "Ensure NPM_TOKEN or NODE_AUTH_TOKEN is set in the runner environment. Verify the package version has been bumped and CHANGELOG is updated before publishing. Consider using a one-time publish token scoped to the specific package."
|
|
14486
14433
|
},
|
|
14487
|
-
//
|
|
14434
|
+
// 6. Elevated / admin permissions
|
|
14488
14435
|
{
|
|
14489
14436
|
ruleId: "ELEVATED_PERMISSIONS",
|
|
14490
14437
|
category: "elevated_permissions",
|
|
@@ -14506,7 +14453,7 @@ var init_capability_analyzer = __esm({
|
|
|
14506
14453
|
message: "The prompt references elevated permissions (admin merge, bypass reviews, skip CI checks). These operations should only be performed by authorised users in exceptional circumstances.",
|
|
14507
14454
|
recommendation: "Document the reason for the elevated operation. Prefer the normal PR review flow. If CI must be skipped, add `[skip ci]` only to non-production changes."
|
|
14508
14455
|
},
|
|
14509
|
-
//
|
|
14456
|
+
// 7. Org/repo admin operations requiring elevated GitHub App permissions (#1878)
|
|
14510
14457
|
//
|
|
14511
14458
|
// The GitHub App integration token used by background sessions is scoped to
|
|
14512
14459
|
// repository-level access. Org-wide or repo-level admin write operations
|
|
@@ -14554,96 +14501,100 @@ var init_capability_analyzer = __esm({
|
|
|
14554
14501
|
message: 'The prompt indicates intent to perform an org-wide or repo-admin operation (rulesets, branch protection write, org settings, or team membership). Background agent sessions run with a GitHub App installation token that, by default, does NOT include "Administration: write" or "Members: write" at the organisation level. These calls will fail with HTTP 403 "Resource not accessible by integration".',
|
|
14555
14502
|
recommendation: 'This operation cannot be completed with the current integration token. Options:\n 1. Use a Personal Access Token (PAT) with the required org/repo admin scopes instead of the integration token \u2014 set it in the session environment as GITHUB_TOKEN.\n 2. Ask a GitHub organisation owner to grant the GAL GitHub App the "Administration" (repository or organisation) and/or "Members" permissions.\n 3. Perform the admin operation manually in the GitHub UI or with a PAT before dispatching the agent session.'
|
|
14556
14503
|
},
|
|
14557
|
-
// 8. Browser
|
|
14504
|
+
// 8. Browser / headed-profile requirements (#4814)
|
|
14558
14505
|
{
|
|
14559
|
-
ruleId: "
|
|
14560
|
-
category: "
|
|
14506
|
+
ruleId: "BROWSER_PROFILE_REQUIRED",
|
|
14507
|
+
category: "browser_profile",
|
|
14561
14508
|
severity: "warning",
|
|
14562
14509
|
patterns: [
|
|
14563
|
-
/
|
|
14564
|
-
/
|
|
14565
|
-
|
|
14566
|
-
|
|
14567
|
-
/
|
|
14568
|
-
/
|
|
14569
|
-
/
|
|
14570
|
-
|
|
14571
|
-
/
|
|
14572
|
-
/
|
|
14573
|
-
/
|
|
14574
|
-
/
|
|
14575
|
-
/
|
|
14576
|
-
/
|
|
14510
|
+
/playwright/i,
|
|
14511
|
+
/puppeteer/i,
|
|
14512
|
+
/\bselenium\b/i,
|
|
14513
|
+
/\bcypress\b/i,
|
|
14514
|
+
/chrome[\s-]?profile/i,
|
|
14515
|
+
/browser[\s-]?profile/i,
|
|
14516
|
+
/headed\s+mode/i,
|
|
14517
|
+
/headed\s+browser/i,
|
|
14518
|
+
/headless\s*=\s*false/i,
|
|
14519
|
+
/visible\s+browser/i,
|
|
14520
|
+
/browser\s+automation/i,
|
|
14521
|
+
/chrome[\s-]?extension\s+test/i,
|
|
14522
|
+
/--headed/i,
|
|
14523
|
+
/user[\s-]?data[\s-]?dir/i
|
|
14577
14524
|
],
|
|
14578
|
-
title: "Browser
|
|
14579
|
-
message: "The prompt
|
|
14580
|
-
recommendation: "
|
|
14525
|
+
title: "Browser or headed-profile access detected",
|
|
14526
|
+
message: "The prompt references browser automation or a headed browser profile. Background agent runners operate in headless environments without display servers. Tests requiring visible browsers or persistent Chrome profiles will fail unless the runner is configured with Xvfb or a remote browser backend.",
|
|
14527
|
+
recommendation: "Use headless mode for Playwright/Puppeteer (`headless: true`). If headed mode is required, ensure the runner image includes Xvfb and browser dependencies. For Chrome extension testing, consider using `@vscode/test-electron` or a dedicated headed runner."
|
|
14581
14528
|
},
|
|
14582
|
-
// 9. Firebase /
|
|
14529
|
+
// 9. Firebase / GCP / cloud service access (#4814)
|
|
14583
14530
|
{
|
|
14584
|
-
ruleId: "
|
|
14585
|
-
category: "
|
|
14531
|
+
ruleId: "CLOUD_ACCESS_REQUIRED",
|
|
14532
|
+
category: "cloud_access",
|
|
14586
14533
|
severity: "warning",
|
|
14587
14534
|
patterns: [
|
|
14535
|
+
/\bfirestore\b/i,
|
|
14588
14536
|
/firebase[\s-]?admin/i,
|
|
14589
|
-
/firestore\s+(read|write|query|update|delete|set|add|batch|transaction)/i,
|
|
14590
|
-
/(read|write|query|update|delete|set|add)\s+.{0,30}firestore/i,
|
|
14591
|
-
/firebase\s+(auth|database|rtdb|realtime|storage|functions|hosting)/i,
|
|
14592
|
-
/FIREBASE_SERVICE_ACCOUNT/i,
|
|
14593
|
-
/FIREBASE_TOKEN/i,
|
|
14594
|
-
/FIREBASE_PROJECT_ID/i,
|
|
14595
|
-
/GOOGLE_APPLICATION_CREDENTIALS/i,
|
|
14596
14537
|
/firebase[\s-]?emulator/i,
|
|
14597
|
-
|
|
14598
|
-
/
|
|
14599
|
-
|
|
14600
|
-
|
|
14601
|
-
|
|
14602
|
-
|
|
14603
|
-
|
|
14604
|
-
|
|
14605
|
-
{
|
|
14606
|
-
ruleId: "CLOUD_ACCESS",
|
|
14607
|
-
category: "cloud_access",
|
|
14608
|
-
severity: "warning",
|
|
14609
|
-
patterns: [
|
|
14610
|
-
/gcloud\s+(auth|config|iam|projects|secrets|kms|storage|compute|sql|pubsub|run\s+services)/i,
|
|
14538
|
+
/\bgcloud\b/i,
|
|
14539
|
+
/google[\s-]?cloud/i,
|
|
14540
|
+
/cloud\s+run/i,
|
|
14541
|
+
/cloud\s+functions?/i,
|
|
14542
|
+
/cloud\s+storage/i,
|
|
14543
|
+
/\bbigquery\b/i,
|
|
14544
|
+
/\bgcs:\/\//i,
|
|
14545
|
+
/gs:\/\//i,
|
|
14611
14546
|
/GCP_SA_KEY/i,
|
|
14547
|
+
/GOOGLE_APPLICATION_CREDENTIALS/i,
|
|
14612
14548
|
/GOOGLE_CLOUD_PROJECT/i,
|
|
14613
|
-
/service[\s-]?account[\s-]?key/i,
|
|
14614
14549
|
/application[\s-]?default[\s-]?credentials/i,
|
|
14615
|
-
/
|
|
14616
|
-
/
|
|
14617
|
-
/
|
|
14618
|
-
/
|
|
14619
|
-
/
|
|
14550
|
+
/service[\s-]?account[\s-]?key/i,
|
|
14551
|
+
/FIREBASE_TOKEN/i,
|
|
14552
|
+
/FIREBASE_PROJECT/i,
|
|
14553
|
+
/firebase\s+deploy/i,
|
|
14554
|
+
/\brtdb\b/i,
|
|
14555
|
+
/realtime[\s-]?database/i,
|
|
14556
|
+
/\baws\b\s+(s3|lambda|ec2|iam|sqs|sns|ecs|eks|rds|dynamodb)/i,
|
|
14557
|
+
/AWS_ACCESS_KEY/i,
|
|
14558
|
+
/AWS_SECRET_ACCESS_KEY/i,
|
|
14559
|
+
/AWS_SESSION_TOKEN/i
|
|
14620
14560
|
],
|
|
14621
|
-
title: "
|
|
14622
|
-
message: "The prompt
|
|
14623
|
-
recommendation: "
|
|
14561
|
+
title: "Cloud service or Firebase access detected",
|
|
14562
|
+
message: "The prompt references Firebase, GCP, or cloud services that require authentication credentials. Background agent runners do not have implicit cloud access. Without proper service-account keys or Application Default Credentials the session will fail with authentication errors.",
|
|
14563
|
+
recommendation: "Ensure the approved config includes an `environment.secrets` entry for the required credentials (e.g. GCP_SA_KEY, GOOGLE_APPLICATION_CREDENTIALS). For Firebase Emulator usage, verify the runner has Java installed. For production Firebase/GCP calls, configure `environment.auth` with a `gcloud-adc` entry."
|
|
14624
14564
|
},
|
|
14625
|
-
//
|
|
14565
|
+
// 10. Environment secrets / auth references in prompt (#4814)
|
|
14626
14566
|
{
|
|
14627
|
-
ruleId: "
|
|
14628
|
-
category: "
|
|
14567
|
+
ruleId: "ENVIRONMENT_SECRETS_REFERENCED",
|
|
14568
|
+
category: "environment_secrets",
|
|
14629
14569
|
severity: "warning",
|
|
14630
14570
|
patterns: [
|
|
14631
|
-
/approved[\s-]?config.{0,30}(secret|auth|credential|environment)/i,
|
|
14632
|
-
/(secret|auth|credential|environment).{0,30}approved[\s-]?config/i,
|
|
14633
|
-
/environment[\s-]?block.{0,30}(secret|auth|key|token)/i,
|
|
14634
|
-
/(secret|auth|key|token).{0,30}environment[\s-]?block/i,
|
|
14635
|
-
/gal[\s-]?config.{0,30}(secret|environment|auth)/i,
|
|
14636
|
-
/(secret|environment|auth).{0,30}gal[\s-]?config/i,
|
|
14637
14571
|
/environment\.secrets/i,
|
|
14638
14572
|
/environment\.auth/i,
|
|
14639
|
-
/
|
|
14640
|
-
/secret[\s-]?manager
|
|
14641
|
-
|
|
14642
|
-
/
|
|
14573
|
+
/approved[\s-]?config.*secret/i,
|
|
14574
|
+
/secret[\s-]?manager/i,
|
|
14575
|
+
/\bvault\b.*secret/i,
|
|
14576
|
+
/secret.*\bvault\b/i,
|
|
14577
|
+
/inject\s+.{0,30}secret/i,
|
|
14578
|
+
/secret\s+injection/i,
|
|
14579
|
+
/rotate\s+.{0,30}(key|token|secret|credential)/i,
|
|
14580
|
+
/(key|token|secret|credential)\s+rotation/i,
|
|
14581
|
+
/\bSSH_KEY\b/i,
|
|
14582
|
+
/\bSSH_PRIVATE_KEY\b/i,
|
|
14583
|
+
/\bAPI_KEY\b/,
|
|
14584
|
+
/\bAPI_SECRET\b/,
|
|
14585
|
+
/\bAUTH_TOKEN\b/i,
|
|
14586
|
+
/\bACCESS_TOKEN\b/,
|
|
14587
|
+
/\bSECRET_KEY\b/,
|
|
14588
|
+
/\bPRIVATE_KEY\b/i,
|
|
14589
|
+
/\bENCRYPTION_KEY\b/i,
|
|
14590
|
+
/\bDATABASE_URL\b.*password/i,
|
|
14591
|
+
/password.*\bDATABASE_URL\b/i,
|
|
14592
|
+
/\.env\.production/i,
|
|
14593
|
+
/\.env\.secret/i
|
|
14643
14594
|
],
|
|
14644
|
-
title: "
|
|
14645
|
-
message: "The prompt references secrets,
|
|
14646
|
-
recommendation: "Verify the
|
|
14595
|
+
title: "Environment secrets or auth configuration referenced",
|
|
14596
|
+
message: "The prompt references environment secrets, auth configuration, or sensitive credential material. The approved config must declare these under `environment.secrets` or `environment.auth` for the runner to resolve them. Without proper declarations the session will start but fail at runtime when the credentials are not found.",
|
|
14597
|
+
recommendation: "Verify the approved config (`gal config get`) includes the referenced secrets under `environment.secrets` or `environment.auth`. Use `gal_set_approved_config` to add missing entries before dispatching. Never embed raw secrets in the prompt \u2014 reference them by name only."
|
|
14647
14598
|
}
|
|
14648
14599
|
];
|
|
14649
14600
|
}
|
|
@@ -17459,7 +17410,7 @@ var require_thread_stream = __commonJS({
|
|
|
17459
17410
|
var { version: version2 } = require_package2();
|
|
17460
17411
|
var { EventEmitter: EventEmitter3 } = require("events");
|
|
17461
17412
|
var { Worker } = require("worker_threads");
|
|
17462
|
-
var { join:
|
|
17413
|
+
var { join: join51 } = require("path");
|
|
17463
17414
|
var { pathToFileURL } = require("url");
|
|
17464
17415
|
var { wait } = require_wait();
|
|
17465
17416
|
var {
|
|
@@ -17495,7 +17446,7 @@ var require_thread_stream = __commonJS({
|
|
|
17495
17446
|
function createWorker(stream, opts) {
|
|
17496
17447
|
const { filename, workerData } = opts;
|
|
17497
17448
|
const bundlerOverrides = "__bundlerPathsOverrides" in globalThis ? globalThis.__bundlerPathsOverrides : {};
|
|
17498
|
-
const toExecute = bundlerOverrides["thread-stream-worker"] ||
|
|
17449
|
+
const toExecute = bundlerOverrides["thread-stream-worker"] || join51(__dirname, "lib", "worker.js");
|
|
17499
17450
|
const worker = new Worker(toExecute, {
|
|
17500
17451
|
...opts.workerOpts,
|
|
17501
17452
|
trackUnmanagedFds: false,
|
|
@@ -17881,7 +17832,7 @@ var require_transport = __commonJS({
|
|
|
17881
17832
|
"use strict";
|
|
17882
17833
|
var { createRequire: createRequire3 } = require("module");
|
|
17883
17834
|
var getCallers = require_caller();
|
|
17884
|
-
var { join:
|
|
17835
|
+
var { join: join51, isAbsolute, sep } = require("node:path");
|
|
17885
17836
|
var sleep2 = require_atomic_sleep();
|
|
17886
17837
|
var onExit2 = require_on_exit_leak_free();
|
|
17887
17838
|
var ThreadStream = require_thread_stream();
|
|
@@ -17944,7 +17895,7 @@ var require_transport = __commonJS({
|
|
|
17944
17895
|
throw new Error("only one of target or targets can be specified");
|
|
17945
17896
|
}
|
|
17946
17897
|
if (targets) {
|
|
17947
|
-
target = bundlerOverrides["pino-worker"] ||
|
|
17898
|
+
target = bundlerOverrides["pino-worker"] || join51(__dirname, "worker.js");
|
|
17948
17899
|
options.targets = targets.filter((dest) => dest.target).map((dest) => {
|
|
17949
17900
|
return {
|
|
17950
17901
|
...dest,
|
|
@@ -17962,7 +17913,7 @@ var require_transport = __commonJS({
|
|
|
17962
17913
|
});
|
|
17963
17914
|
});
|
|
17964
17915
|
} else if (pipeline) {
|
|
17965
|
-
target = bundlerOverrides["pino-worker"] ||
|
|
17916
|
+
target = bundlerOverrides["pino-worker"] || join51(__dirname, "worker.js");
|
|
17966
17917
|
options.pipelines = [pipeline.map((dest) => {
|
|
17967
17918
|
return {
|
|
17968
17919
|
...dest,
|
|
@@ -17984,7 +17935,7 @@ var require_transport = __commonJS({
|
|
|
17984
17935
|
return origin;
|
|
17985
17936
|
}
|
|
17986
17937
|
if (origin === "pino/file") {
|
|
17987
|
-
return
|
|
17938
|
+
return join51(__dirname, "..", "file.js");
|
|
17988
17939
|
}
|
|
17989
17940
|
let fixTarget2;
|
|
17990
17941
|
for (const filePath of callers) {
|
|
@@ -18973,7 +18924,7 @@ var require_safe_stable_stringify = __commonJS({
|
|
|
18973
18924
|
return circularValue;
|
|
18974
18925
|
}
|
|
18975
18926
|
let res = "";
|
|
18976
|
-
let
|
|
18927
|
+
let join51 = ",";
|
|
18977
18928
|
const originalIndentation = indentation;
|
|
18978
18929
|
if (Array.isArray(value)) {
|
|
18979
18930
|
if (value.length === 0) {
|
|
@@ -18987,7 +18938,7 @@ var require_safe_stable_stringify = __commonJS({
|
|
|
18987
18938
|
indentation += spacer;
|
|
18988
18939
|
res += `
|
|
18989
18940
|
${indentation}`;
|
|
18990
|
-
|
|
18941
|
+
join51 = `,
|
|
18991
18942
|
${indentation}`;
|
|
18992
18943
|
}
|
|
18993
18944
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
@@ -18995,13 +18946,13 @@ ${indentation}`;
|
|
|
18995
18946
|
for (; i < maximumValuesToStringify - 1; i++) {
|
|
18996
18947
|
const tmp2 = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
|
|
18997
18948
|
res += tmp2 !== void 0 ? tmp2 : "null";
|
|
18998
|
-
res +=
|
|
18949
|
+
res += join51;
|
|
18999
18950
|
}
|
|
19000
18951
|
const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
|
|
19001
18952
|
res += tmp !== void 0 ? tmp : "null";
|
|
19002
18953
|
if (value.length - 1 > maximumBreadth) {
|
|
19003
18954
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
19004
|
-
res += `${
|
|
18955
|
+
res += `${join51}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
19005
18956
|
}
|
|
19006
18957
|
if (spacer !== "") {
|
|
19007
18958
|
res += `
|
|
@@ -19022,7 +18973,7 @@ ${originalIndentation}`;
|
|
|
19022
18973
|
let separator = "";
|
|
19023
18974
|
if (spacer !== "") {
|
|
19024
18975
|
indentation += spacer;
|
|
19025
|
-
|
|
18976
|
+
join51 = `,
|
|
19026
18977
|
${indentation}`;
|
|
19027
18978
|
whitespace = " ";
|
|
19028
18979
|
}
|
|
@@ -19036,13 +18987,13 @@ ${indentation}`;
|
|
|
19036
18987
|
const tmp = stringifyFnReplacer(key2, value, stack, replacer, spacer, indentation);
|
|
19037
18988
|
if (tmp !== void 0) {
|
|
19038
18989
|
res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
|
|
19039
|
-
separator =
|
|
18990
|
+
separator = join51;
|
|
19040
18991
|
}
|
|
19041
18992
|
}
|
|
19042
18993
|
if (keyLength > maximumBreadth) {
|
|
19043
18994
|
const removedKeys = keyLength - maximumBreadth;
|
|
19044
18995
|
res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`;
|
|
19045
|
-
separator =
|
|
18996
|
+
separator = join51;
|
|
19046
18997
|
}
|
|
19047
18998
|
if (spacer !== "" && separator.length > 1) {
|
|
19048
18999
|
res = `
|
|
@@ -19083,7 +19034,7 @@ ${originalIndentation}`;
|
|
|
19083
19034
|
}
|
|
19084
19035
|
const originalIndentation = indentation;
|
|
19085
19036
|
let res = "";
|
|
19086
|
-
let
|
|
19037
|
+
let join51 = ",";
|
|
19087
19038
|
if (Array.isArray(value)) {
|
|
19088
19039
|
if (value.length === 0) {
|
|
19089
19040
|
return "[]";
|
|
@@ -19096,7 +19047,7 @@ ${originalIndentation}`;
|
|
|
19096
19047
|
indentation += spacer;
|
|
19097
19048
|
res += `
|
|
19098
19049
|
${indentation}`;
|
|
19099
|
-
|
|
19050
|
+
join51 = `,
|
|
19100
19051
|
${indentation}`;
|
|
19101
19052
|
}
|
|
19102
19053
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
@@ -19104,13 +19055,13 @@ ${indentation}`;
|
|
|
19104
19055
|
for (; i < maximumValuesToStringify - 1; i++) {
|
|
19105
19056
|
const tmp2 = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
|
|
19106
19057
|
res += tmp2 !== void 0 ? tmp2 : "null";
|
|
19107
|
-
res +=
|
|
19058
|
+
res += join51;
|
|
19108
19059
|
}
|
|
19109
19060
|
const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
|
|
19110
19061
|
res += tmp !== void 0 ? tmp : "null";
|
|
19111
19062
|
if (value.length - 1 > maximumBreadth) {
|
|
19112
19063
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
19113
|
-
res += `${
|
|
19064
|
+
res += `${join51}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
19114
19065
|
}
|
|
19115
19066
|
if (spacer !== "") {
|
|
19116
19067
|
res += `
|
|
@@ -19123,7 +19074,7 @@ ${originalIndentation}`;
|
|
|
19123
19074
|
let whitespace = "";
|
|
19124
19075
|
if (spacer !== "") {
|
|
19125
19076
|
indentation += spacer;
|
|
19126
|
-
|
|
19077
|
+
join51 = `,
|
|
19127
19078
|
${indentation}`;
|
|
19128
19079
|
whitespace = " ";
|
|
19129
19080
|
}
|
|
@@ -19132,7 +19083,7 @@ ${indentation}`;
|
|
|
19132
19083
|
const tmp = stringifyArrayReplacer(key2, value[key2], stack, replacer, spacer, indentation);
|
|
19133
19084
|
if (tmp !== void 0) {
|
|
19134
19085
|
res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
|
|
19135
|
-
separator =
|
|
19086
|
+
separator = join51;
|
|
19136
19087
|
}
|
|
19137
19088
|
}
|
|
19138
19089
|
if (spacer !== "" && separator.length > 1) {
|
|
@@ -19190,20 +19141,20 @@ ${originalIndentation}`;
|
|
|
19190
19141
|
indentation += spacer;
|
|
19191
19142
|
let res2 = `
|
|
19192
19143
|
${indentation}`;
|
|
19193
|
-
const
|
|
19144
|
+
const join52 = `,
|
|
19194
19145
|
${indentation}`;
|
|
19195
19146
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
19196
19147
|
let i = 0;
|
|
19197
19148
|
for (; i < maximumValuesToStringify - 1; i++) {
|
|
19198
19149
|
const tmp2 = stringifyIndent(String(i), value[i], stack, spacer, indentation);
|
|
19199
19150
|
res2 += tmp2 !== void 0 ? tmp2 : "null";
|
|
19200
|
-
res2 +=
|
|
19151
|
+
res2 += join52;
|
|
19201
19152
|
}
|
|
19202
19153
|
const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation);
|
|
19203
19154
|
res2 += tmp !== void 0 ? tmp : "null";
|
|
19204
19155
|
if (value.length - 1 > maximumBreadth) {
|
|
19205
19156
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
19206
|
-
res2 += `${
|
|
19157
|
+
res2 += `${join52}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
19207
19158
|
}
|
|
19208
19159
|
res2 += `
|
|
19209
19160
|
${originalIndentation}`;
|
|
@@ -19219,16 +19170,16 @@ ${originalIndentation}`;
|
|
|
19219
19170
|
return '"[Object]"';
|
|
19220
19171
|
}
|
|
19221
19172
|
indentation += spacer;
|
|
19222
|
-
const
|
|
19173
|
+
const join51 = `,
|
|
19223
19174
|
${indentation}`;
|
|
19224
19175
|
let res = "";
|
|
19225
19176
|
let separator = "";
|
|
19226
19177
|
let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
|
|
19227
19178
|
if (isTypedArrayWithEntries(value)) {
|
|
19228
|
-
res += stringifyTypedArray(value,
|
|
19179
|
+
res += stringifyTypedArray(value, join51, maximumBreadth);
|
|
19229
19180
|
keys = keys.slice(value.length);
|
|
19230
19181
|
maximumPropertiesToStringify -= value.length;
|
|
19231
|
-
separator =
|
|
19182
|
+
separator = join51;
|
|
19232
19183
|
}
|
|
19233
19184
|
if (deterministic) {
|
|
19234
19185
|
keys = sort(keys, comparator);
|
|
@@ -19239,13 +19190,13 @@ ${indentation}`;
|
|
|
19239
19190
|
const tmp = stringifyIndent(key2, value[key2], stack, spacer, indentation);
|
|
19240
19191
|
if (tmp !== void 0) {
|
|
19241
19192
|
res += `${separator}${strEscape(key2)}: ${tmp}`;
|
|
19242
|
-
separator =
|
|
19193
|
+
separator = join51;
|
|
19243
19194
|
}
|
|
19244
19195
|
}
|
|
19245
19196
|
if (keyLength > maximumBreadth) {
|
|
19246
19197
|
const removedKeys = keyLength - maximumBreadth;
|
|
19247
19198
|
res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
|
|
19248
|
-
separator =
|
|
19199
|
+
separator = join51;
|
|
19249
19200
|
}
|
|
19250
19201
|
if (separator !== "") {
|
|
19251
19202
|
res = `
|
|
@@ -20581,7 +20532,7 @@ var init_AgentQueueService = __esm({
|
|
|
20581
20532
|
* @returns {Promise<{ success: boolean; output?: string; error?: string }>} Execution result
|
|
20582
20533
|
*/
|
|
20583
20534
|
runShellCommand(command) {
|
|
20584
|
-
return new Promise((
|
|
20535
|
+
return new Promise((resolve11) => {
|
|
20585
20536
|
this.claudeProcess = (0, import_child_process3.spawn)("/bin/sh", ["-c", command], {
|
|
20586
20537
|
cwd: this.config.workdir,
|
|
20587
20538
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -20599,14 +20550,14 @@ var init_AgentQueueService = __esm({
|
|
|
20599
20550
|
this.claudeProcess.on("close", (code) => {
|
|
20600
20551
|
this.claudeProcess = null;
|
|
20601
20552
|
if (code === 0) {
|
|
20602
|
-
|
|
20553
|
+
resolve11({ success: true, output: stdout });
|
|
20603
20554
|
} else {
|
|
20604
|
-
|
|
20555
|
+
resolve11({ success: false, error: stderr || `Exit code ${code}` });
|
|
20605
20556
|
}
|
|
20606
20557
|
});
|
|
20607
20558
|
this.claudeProcess.on("error", (error3) => {
|
|
20608
20559
|
this.claudeProcess = null;
|
|
20609
|
-
|
|
20560
|
+
resolve11({ success: false, error: error3.message });
|
|
20610
20561
|
});
|
|
20611
20562
|
});
|
|
20612
20563
|
}
|
|
@@ -20618,7 +20569,7 @@ var init_AgentQueueService = __esm({
|
|
|
20618
20569
|
* @returns {Promise<{ success: boolean; output?: string; error?: string }>} Execution result
|
|
20619
20570
|
*/
|
|
20620
20571
|
runClaudeCodePrompt(command) {
|
|
20621
|
-
return new Promise((
|
|
20572
|
+
return new Promise((resolve11) => {
|
|
20622
20573
|
this.claudeProcess = (0, import_child_process3.spawn)(
|
|
20623
20574
|
"claude",
|
|
20624
20575
|
["-p", command, "--dangerously-skip-permissions"],
|
|
@@ -20645,20 +20596,20 @@ var init_AgentQueueService = __esm({
|
|
|
20645
20596
|
this.claudeProcess.on("close", (code) => {
|
|
20646
20597
|
this.claudeProcess = null;
|
|
20647
20598
|
if (code === 0) {
|
|
20648
|
-
|
|
20599
|
+
resolve11({ success: true, output: stdout });
|
|
20649
20600
|
} else {
|
|
20650
|
-
|
|
20601
|
+
resolve11({ success: false, error: stderr || `Exit code ${code}` });
|
|
20651
20602
|
}
|
|
20652
20603
|
});
|
|
20653
20604
|
this.claudeProcess.on("error", (error3) => {
|
|
20654
20605
|
this.claudeProcess = null;
|
|
20655
|
-
|
|
20606
|
+
resolve11({ success: false, error: error3.message });
|
|
20656
20607
|
});
|
|
20657
20608
|
setTimeout(() => {
|
|
20658
20609
|
if (this.claudeProcess) {
|
|
20659
20610
|
logger2.warn("Claude Code execution timed out after 30 minutes");
|
|
20660
20611
|
this.claudeProcess.kill();
|
|
20661
|
-
|
|
20612
|
+
resolve11({ success: false, error: "Execution timed out" });
|
|
20662
20613
|
}
|
|
20663
20614
|
}, 30 * 60 * 1e3);
|
|
20664
20615
|
});
|
|
@@ -27758,7 +27709,7 @@ var init_protocol = __esm({
|
|
|
27758
27709
|
return;
|
|
27759
27710
|
}
|
|
27760
27711
|
const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
|
|
27761
|
-
await new Promise((
|
|
27712
|
+
await new Promise((resolve11) => setTimeout(resolve11, pollInterval));
|
|
27762
27713
|
options?.signal?.throwIfAborted();
|
|
27763
27714
|
}
|
|
27764
27715
|
} catch (error3) {
|
|
@@ -27775,7 +27726,7 @@ var init_protocol = __esm({
|
|
|
27775
27726
|
*/
|
|
27776
27727
|
request(request, resultSchema, options) {
|
|
27777
27728
|
const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
|
|
27778
|
-
return new Promise((
|
|
27729
|
+
return new Promise((resolve11, reject) => {
|
|
27779
27730
|
const earlyReject = (error3) => {
|
|
27780
27731
|
reject(error3);
|
|
27781
27732
|
};
|
|
@@ -27853,7 +27804,7 @@ var init_protocol = __esm({
|
|
|
27853
27804
|
if (!parseResult.success) {
|
|
27854
27805
|
reject(parseResult.error);
|
|
27855
27806
|
} else {
|
|
27856
|
-
|
|
27807
|
+
resolve11(parseResult.data);
|
|
27857
27808
|
}
|
|
27858
27809
|
} catch (error3) {
|
|
27859
27810
|
reject(error3);
|
|
@@ -28114,12 +28065,12 @@ var init_protocol = __esm({
|
|
|
28114
28065
|
}
|
|
28115
28066
|
} catch {
|
|
28116
28067
|
}
|
|
28117
|
-
return new Promise((
|
|
28068
|
+
return new Promise((resolve11, reject) => {
|
|
28118
28069
|
if (signal.aborted) {
|
|
28119
28070
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
28120
28071
|
return;
|
|
28121
28072
|
}
|
|
28122
|
-
const timeoutId = setTimeout(
|
|
28073
|
+
const timeoutId = setTimeout(resolve11, interval);
|
|
28123
28074
|
signal.addEventListener("abort", () => {
|
|
28124
28075
|
clearTimeout(timeoutId);
|
|
28125
28076
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
@@ -31146,7 +31097,7 @@ var require_compile = __commonJS({
|
|
|
31146
31097
|
const schOrFunc = root.refs[ref];
|
|
31147
31098
|
if (schOrFunc)
|
|
31148
31099
|
return schOrFunc;
|
|
31149
|
-
let _sch =
|
|
31100
|
+
let _sch = resolve11.call(this, root, ref);
|
|
31150
31101
|
if (_sch === void 0) {
|
|
31151
31102
|
const schema = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref];
|
|
31152
31103
|
const { schemaId } = this.opts;
|
|
@@ -31173,7 +31124,7 @@ var require_compile = __commonJS({
|
|
|
31173
31124
|
function sameSchemaEnv(s1, s2) {
|
|
31174
31125
|
return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
|
|
31175
31126
|
}
|
|
31176
|
-
function
|
|
31127
|
+
function resolve11(root, ref) {
|
|
31177
31128
|
let sch;
|
|
31178
31129
|
while (typeof (sch = this.refs[ref]) == "string")
|
|
31179
31130
|
ref = sch;
|
|
@@ -31748,7 +31699,7 @@ var require_fast_uri = __commonJS({
|
|
|
31748
31699
|
}
|
|
31749
31700
|
return uri;
|
|
31750
31701
|
}
|
|
31751
|
-
function
|
|
31702
|
+
function resolve11(baseURI, relativeURI, options) {
|
|
31752
31703
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
31753
31704
|
const resolved = resolveComponent(parse4(baseURI, schemelessOptions), parse4(relativeURI, schemelessOptions), schemelessOptions, true);
|
|
31754
31705
|
schemelessOptions.skipEscape = true;
|
|
@@ -31975,7 +31926,7 @@ var require_fast_uri = __commonJS({
|
|
|
31975
31926
|
var fastUri = {
|
|
31976
31927
|
SCHEMES,
|
|
31977
31928
|
normalize,
|
|
31978
|
-
resolve:
|
|
31929
|
+
resolve: resolve11,
|
|
31979
31930
|
resolveComponent,
|
|
31980
31931
|
equal,
|
|
31981
31932
|
serialize,
|
|
@@ -35633,12 +35584,12 @@ var init_stdio2 = __esm({
|
|
|
35633
35584
|
this.onclose?.();
|
|
35634
35585
|
}
|
|
35635
35586
|
send(message) {
|
|
35636
|
-
return new Promise((
|
|
35587
|
+
return new Promise((resolve11) => {
|
|
35637
35588
|
const json = serializeMessage(message);
|
|
35638
35589
|
if (this._stdout.write(json)) {
|
|
35639
|
-
|
|
35590
|
+
resolve11();
|
|
35640
35591
|
} else {
|
|
35641
|
-
this._stdout.once("drain",
|
|
35592
|
+
this._stdout.once("drain", resolve11);
|
|
35642
35593
|
}
|
|
35643
35594
|
});
|
|
35644
35595
|
}
|
|
@@ -36516,11 +36467,11 @@ function createApprovedConfigCommand() {
|
|
|
36516
36467
|
const spinner = options.json ? null : ora(`Fetching approved config for "${org}"...`).start();
|
|
36517
36468
|
try {
|
|
36518
36469
|
let findMdFiles2 = function(dir) {
|
|
36519
|
-
if (!
|
|
36470
|
+
if (!existsSync47(dir)) return [];
|
|
36520
36471
|
const entries = readdirSync19(dir, { withFileTypes: true });
|
|
36521
36472
|
const files = [];
|
|
36522
36473
|
for (const entry of entries) {
|
|
36523
|
-
const fullPath =
|
|
36474
|
+
const fullPath = join51(dir, entry.name);
|
|
36524
36475
|
if (entry.isDirectory()) files.push(...findMdFiles2(fullPath));
|
|
36525
36476
|
else if (entry.name.endsWith(".md")) files.push(fullPath);
|
|
36526
36477
|
}
|
|
@@ -36538,11 +36489,11 @@ function createApprovedConfigCommand() {
|
|
|
36538
36489
|
}
|
|
36539
36490
|
return;
|
|
36540
36491
|
}
|
|
36541
|
-
const { existsSync:
|
|
36542
|
-
const { join:
|
|
36492
|
+
const { existsSync: existsSync47, readdirSync: readdirSync19, readFileSync: readFileSync42 } = await import("fs");
|
|
36493
|
+
const { join: join51, relative: relative10, basename: basename9 } = await import("path");
|
|
36543
36494
|
const baseDir = options.dir || process.cwd();
|
|
36544
|
-
const commandsDir =
|
|
36545
|
-
const agentsDir =
|
|
36495
|
+
const commandsDir = join51(baseDir, ".claude", "commands");
|
|
36496
|
+
const agentsDir = join51(baseDir, ".claude", "agents");
|
|
36546
36497
|
const localCommandNames = findMdFiles2(commandsDir).map(
|
|
36547
36498
|
(f) => relative10(commandsDir, f).replace(/\.md$/, "").replace(/\//g, ":")
|
|
36548
36499
|
);
|
|
@@ -48311,11 +48262,11 @@ function resolveLocalStorageState(profileDir) {
|
|
|
48311
48262
|
);
|
|
48312
48263
|
}
|
|
48313
48264
|
function mergeStorageStateFiles2(filePaths, outputPath) {
|
|
48314
|
-
const { readFileSync:
|
|
48265
|
+
const { readFileSync: readFileSync42 } = require("fs");
|
|
48315
48266
|
const cookieMap = /* @__PURE__ */ new Map();
|
|
48316
48267
|
const originMap = /* @__PURE__ */ new Map();
|
|
48317
48268
|
for (const filePath of filePaths) {
|
|
48318
|
-
const raw =
|
|
48269
|
+
const raw = readFileSync42(filePath, "utf8");
|
|
48319
48270
|
const parsed = JSON.parse(raw);
|
|
48320
48271
|
for (const cookie of parsed.cookies ?? []) {
|
|
48321
48272
|
const key = cookieKey2(cookie);
|
|
@@ -48354,6 +48305,151 @@ var init_browser_profile_sync = __esm({
|
|
|
48354
48305
|
}
|
|
48355
48306
|
});
|
|
48356
48307
|
|
|
48308
|
+
// src/utils/sync-initialization.ts
|
|
48309
|
+
function nowIso() {
|
|
48310
|
+
return (/* @__PURE__ */ new Date()).toISOString();
|
|
48311
|
+
}
|
|
48312
|
+
function createEmptyRegistry() {
|
|
48313
|
+
return {
|
|
48314
|
+
schemaVersion: REGISTRY_SCHEMA_VERSION,
|
|
48315
|
+
initializedDirectories: [],
|
|
48316
|
+
updatedAt: nowIso()
|
|
48317
|
+
};
|
|
48318
|
+
}
|
|
48319
|
+
function normalizeDirectory(directory) {
|
|
48320
|
+
return (0, import_path21.resolve)(directory);
|
|
48321
|
+
}
|
|
48322
|
+
function sanitizeDirectories(directories) {
|
|
48323
|
+
if (!Array.isArray(directories)) {
|
|
48324
|
+
return [];
|
|
48325
|
+
}
|
|
48326
|
+
const unique = /* @__PURE__ */ new Set();
|
|
48327
|
+
for (const dir of directories) {
|
|
48328
|
+
if (typeof dir !== "string" || dir.trim() === "") {
|
|
48329
|
+
continue;
|
|
48330
|
+
}
|
|
48331
|
+
unique.add(normalizeDirectory(dir));
|
|
48332
|
+
}
|
|
48333
|
+
return Array.from(unique);
|
|
48334
|
+
}
|
|
48335
|
+
function writeRegistry(registry2) {
|
|
48336
|
+
const registryPath = getSyncInitializationRegistryPath();
|
|
48337
|
+
const registryDir = (0, import_path21.dirname)(registryPath);
|
|
48338
|
+
if (!(0, import_fs22.existsSync)(registryDir)) {
|
|
48339
|
+
(0, import_fs22.mkdirSync)(registryDir, { recursive: true });
|
|
48340
|
+
}
|
|
48341
|
+
(0, import_fs22.writeFileSync)(registryPath, JSON.stringify(registry2, null, 2) + "\n", "utf-8");
|
|
48342
|
+
}
|
|
48343
|
+
function readRegistry(pruneMissingDirectories) {
|
|
48344
|
+
const registryPath = getSyncInitializationRegistryPath();
|
|
48345
|
+
if (!(0, import_fs22.existsSync)(registryPath)) {
|
|
48346
|
+
return {
|
|
48347
|
+
registry: createEmptyRegistry(),
|
|
48348
|
+
prunedStaleEntries: 0
|
|
48349
|
+
};
|
|
48350
|
+
}
|
|
48351
|
+
let parsed;
|
|
48352
|
+
try {
|
|
48353
|
+
const raw = JSON.parse((0, import_fs22.readFileSync)(registryPath, "utf-8"));
|
|
48354
|
+
if (Array.isArray(raw)) {
|
|
48355
|
+
parsed = {
|
|
48356
|
+
schemaVersion: REGISTRY_SCHEMA_VERSION,
|
|
48357
|
+
initializedDirectories: sanitizeDirectories(raw),
|
|
48358
|
+
updatedAt: nowIso()
|
|
48359
|
+
};
|
|
48360
|
+
} else {
|
|
48361
|
+
parsed = {
|
|
48362
|
+
schemaVersion: REGISTRY_SCHEMA_VERSION,
|
|
48363
|
+
initializedDirectories: sanitizeDirectories(raw.initializedDirectories),
|
|
48364
|
+
updatedAt: typeof raw.updatedAt === "string" ? raw.updatedAt : nowIso()
|
|
48365
|
+
};
|
|
48366
|
+
}
|
|
48367
|
+
} catch {
|
|
48368
|
+
parsed = createEmptyRegistry();
|
|
48369
|
+
}
|
|
48370
|
+
const originalCount = parsed.initializedDirectories.length;
|
|
48371
|
+
const directories = pruneMissingDirectories ? parsed.initializedDirectories.filter((dir) => (0, import_fs22.existsSync)(dir)) : parsed.initializedDirectories;
|
|
48372
|
+
const prunedStaleEntries = originalCount - directories.length;
|
|
48373
|
+
const needsRewrite = parsed.schemaVersion !== REGISTRY_SCHEMA_VERSION || prunedStaleEntries > 0 || directories.length !== parsed.initializedDirectories.length;
|
|
48374
|
+
const normalizedRegistry = {
|
|
48375
|
+
schemaVersion: REGISTRY_SCHEMA_VERSION,
|
|
48376
|
+
initializedDirectories: directories,
|
|
48377
|
+
updatedAt: needsRewrite ? nowIso() : parsed.updatedAt
|
|
48378
|
+
};
|
|
48379
|
+
if (needsRewrite) {
|
|
48380
|
+
writeRegistry(normalizedRegistry);
|
|
48381
|
+
}
|
|
48382
|
+
return {
|
|
48383
|
+
registry: normalizedRegistry,
|
|
48384
|
+
prunedStaleEntries
|
|
48385
|
+
};
|
|
48386
|
+
}
|
|
48387
|
+
function getSyncInitializationRegistryPath() {
|
|
48388
|
+
return process.env.GAL_INIT_REGISTRY_PATH || DEFAULT_REGISTRY_PATH;
|
|
48389
|
+
}
|
|
48390
|
+
function getInitializedDirectories(options) {
|
|
48391
|
+
const { registry: registry2 } = readRegistry(options?.pruneMissingDirectories !== false);
|
|
48392
|
+
return [...registry2.initializedDirectories];
|
|
48393
|
+
}
|
|
48394
|
+
function shouldRunAutoSync(projectDirectory, sessionDirectory = process.cwd()) {
|
|
48395
|
+
const initialized2 = new Set(getInitializedDirectories());
|
|
48396
|
+
return initialized2.has(normalizeDirectory(projectDirectory)) || initialized2.has(normalizeDirectory(sessionDirectory));
|
|
48397
|
+
}
|
|
48398
|
+
function initializeDirectory(directory) {
|
|
48399
|
+
const normalizedDirectory = normalizeDirectory(directory);
|
|
48400
|
+
const { registry: registry2, prunedStaleEntries } = readRegistry(true);
|
|
48401
|
+
if (registry2.initializedDirectories.includes(normalizedDirectory)) {
|
|
48402
|
+
return {
|
|
48403
|
+
directory: normalizedDirectory,
|
|
48404
|
+
alreadyInitialized: true,
|
|
48405
|
+
totalInitialized: registry2.initializedDirectories.length,
|
|
48406
|
+
prunedStaleEntries
|
|
48407
|
+
};
|
|
48408
|
+
}
|
|
48409
|
+
const updatedRegistry = {
|
|
48410
|
+
schemaVersion: REGISTRY_SCHEMA_VERSION,
|
|
48411
|
+
initializedDirectories: [...registry2.initializedDirectories, normalizedDirectory],
|
|
48412
|
+
updatedAt: nowIso()
|
|
48413
|
+
};
|
|
48414
|
+
writeRegistry(updatedRegistry);
|
|
48415
|
+
return {
|
|
48416
|
+
directory: normalizedDirectory,
|
|
48417
|
+
alreadyInitialized: false,
|
|
48418
|
+
totalInitialized: updatedRegistry.initializedDirectories.length,
|
|
48419
|
+
prunedStaleEntries
|
|
48420
|
+
};
|
|
48421
|
+
}
|
|
48422
|
+
function removeInitializedDirectory(directory) {
|
|
48423
|
+
const normalizedDirectory = normalizeDirectory(directory);
|
|
48424
|
+
const { registry: registry2, prunedStaleEntries } = readRegistry(true);
|
|
48425
|
+
const filtered = registry2.initializedDirectories.filter((entry) => entry !== normalizedDirectory);
|
|
48426
|
+
const removed = filtered.length !== registry2.initializedDirectories.length;
|
|
48427
|
+
if (removed) {
|
|
48428
|
+
writeRegistry({
|
|
48429
|
+
schemaVersion: REGISTRY_SCHEMA_VERSION,
|
|
48430
|
+
initializedDirectories: filtered,
|
|
48431
|
+
updatedAt: nowIso()
|
|
48432
|
+
});
|
|
48433
|
+
}
|
|
48434
|
+
return {
|
|
48435
|
+
directory: normalizedDirectory,
|
|
48436
|
+
removed,
|
|
48437
|
+
totalInitialized: filtered.length,
|
|
48438
|
+
prunedStaleEntries
|
|
48439
|
+
};
|
|
48440
|
+
}
|
|
48441
|
+
var import_fs22, import_os16, import_path21, REGISTRY_SCHEMA_VERSION, DEFAULT_REGISTRY_PATH;
|
|
48442
|
+
var init_sync_initialization = __esm({
|
|
48443
|
+
"src/utils/sync-initialization.ts"() {
|
|
48444
|
+
"use strict";
|
|
48445
|
+
import_fs22 = require("fs");
|
|
48446
|
+
import_os16 = require("os");
|
|
48447
|
+
import_path21 = require("path");
|
|
48448
|
+
REGISTRY_SCHEMA_VERSION = 1;
|
|
48449
|
+
DEFAULT_REGISTRY_PATH = (0, import_path21.join)((0, import_os16.homedir)(), ".gal", "initialized-dirs.json");
|
|
48450
|
+
}
|
|
48451
|
+
});
|
|
48452
|
+
|
|
48357
48453
|
// src/utils/drift-check.ts
|
|
48358
48454
|
var drift_check_exports = {};
|
|
48359
48455
|
__export(drift_check_exports, {
|
|
@@ -48367,12 +48463,12 @@ function hashContent(content) {
|
|
|
48367
48463
|
return (0, import_crypto5.createHash)("sha256").update(content).digest("hex").substring(0, 16);
|
|
48368
48464
|
}
|
|
48369
48465
|
function getUserSettingsPath() {
|
|
48370
|
-
return (0,
|
|
48466
|
+
return (0, import_path22.join)((0, import_os17.homedir)(), ".claude", "settings.json");
|
|
48371
48467
|
}
|
|
48372
48468
|
function readLocalSettings(settingsPath) {
|
|
48373
|
-
if (!(0,
|
|
48469
|
+
if (!(0, import_fs23.existsSync)(settingsPath)) return null;
|
|
48374
48470
|
try {
|
|
48375
|
-
return (0,
|
|
48471
|
+
return (0, import_fs23.readFileSync)(settingsPath, "utf-8");
|
|
48376
48472
|
} catch {
|
|
48377
48473
|
return null;
|
|
48378
48474
|
}
|
|
@@ -48432,10 +48528,10 @@ function printDriftWarning(result) {
|
|
|
48432
48528
|
console.log();
|
|
48433
48529
|
}
|
|
48434
48530
|
async function runSessionDriftCheck(projectRoot) {
|
|
48435
|
-
const syncStatePath = (0,
|
|
48436
|
-
if (!(0,
|
|
48531
|
+
const syncStatePath = (0, import_path22.join)(projectRoot, ".gal", "sync-state.json");
|
|
48532
|
+
if (!(0, import_fs23.existsSync)(syncStatePath)) return null;
|
|
48437
48533
|
try {
|
|
48438
|
-
const stateContent = (0,
|
|
48534
|
+
const stateContent = (0, import_fs23.readFileSync)(syncStatePath, "utf-8");
|
|
48439
48535
|
const state = JSON.parse(stateContent);
|
|
48440
48536
|
const claudeState = state.platforms?.claude;
|
|
48441
48537
|
const orgHash = claudeState?.lastSyncHash || state.lastSyncHash || null;
|
|
@@ -48465,13 +48561,13 @@ async function runSessionDriftCheck(projectRoot) {
|
|
|
48465
48561
|
return null;
|
|
48466
48562
|
}
|
|
48467
48563
|
}
|
|
48468
|
-
var
|
|
48564
|
+
var import_fs23, import_path22, import_os17, import_crypto5;
|
|
48469
48565
|
var init_drift_check = __esm({
|
|
48470
48566
|
"src/utils/drift-check.ts"() {
|
|
48471
48567
|
"use strict";
|
|
48472
|
-
|
|
48473
|
-
|
|
48474
|
-
|
|
48568
|
+
import_fs23 = require("fs");
|
|
48569
|
+
import_path22 = require("path");
|
|
48570
|
+
import_os17 = require("os");
|
|
48475
48571
|
import_crypto5 = require("crypto");
|
|
48476
48572
|
init_source();
|
|
48477
48573
|
init_config_manager();
|
|
@@ -48483,30 +48579,30 @@ function countEnabledDispatchCategories(categories) {
|
|
|
48483
48579
|
return getValidDispatchCategories(categories).filter((category) => category.enabled).length;
|
|
48484
48580
|
}
|
|
48485
48581
|
function installCursorGalCliRules(directory) {
|
|
48486
|
-
const cursorRulesDir = (0,
|
|
48487
|
-
const rulesPath = (0,
|
|
48582
|
+
const cursorRulesDir = (0, import_path23.join)(directory, ".cursor", "rules", "gal-cli");
|
|
48583
|
+
const rulesPath = (0, import_path23.join)(cursorRulesDir, "RULE.md");
|
|
48488
48584
|
try {
|
|
48489
|
-
if ((0,
|
|
48490
|
-
const existingContent = (0,
|
|
48585
|
+
if ((0, import_fs24.existsSync)(rulesPath)) {
|
|
48586
|
+
const existingContent = (0, import_fs24.readFileSync)(rulesPath, "utf-8");
|
|
48491
48587
|
const versionMatch = existingContent.match(/GAL_CURSOR_RULES_VERSION = "([^"]+)"/);
|
|
48492
48588
|
if (versionMatch && versionMatch[1] === GAL_CLI_CURSOR_RULES_VERSION) {
|
|
48493
48589
|
return true;
|
|
48494
48590
|
}
|
|
48495
48591
|
}
|
|
48496
|
-
if (!(0,
|
|
48497
|
-
(0,
|
|
48592
|
+
if (!(0, import_fs24.existsSync)(cursorRulesDir)) {
|
|
48593
|
+
(0, import_fs24.mkdirSync)(cursorRulesDir, { recursive: true });
|
|
48498
48594
|
}
|
|
48499
|
-
(0,
|
|
48595
|
+
(0, import_fs24.writeFileSync)(rulesPath, GAL_CLI_CURSOR_RULES, "utf-8");
|
|
48500
48596
|
return true;
|
|
48501
48597
|
} catch {
|
|
48502
48598
|
return false;
|
|
48503
48599
|
}
|
|
48504
48600
|
}
|
|
48505
48601
|
function writeSyncStateV2(orgName, platformStates, hookSettings) {
|
|
48506
|
-
const galDir = (0,
|
|
48507
|
-
const statePath = (0,
|
|
48508
|
-
if (!(0,
|
|
48509
|
-
(0,
|
|
48602
|
+
const galDir = (0, import_path23.join)(process.cwd(), ".gal");
|
|
48603
|
+
const statePath = (0, import_path23.join)(galDir, "sync-state.json");
|
|
48604
|
+
if (!(0, import_fs24.existsSync)(galDir)) {
|
|
48605
|
+
(0, import_fs24.mkdirSync)(galDir, { recursive: true });
|
|
48510
48606
|
}
|
|
48511
48607
|
const platforms = {};
|
|
48512
48608
|
for (const [platform5, state2] of platformStates) {
|
|
@@ -48527,7 +48623,7 @@ function writeSyncStateV2(orgName, platformStates, hookSettings) {
|
|
|
48527
48623
|
// After a successful sync, approved hash matches local hash
|
|
48528
48624
|
approvedConfigHash: primaryState?.lastSyncHash
|
|
48529
48625
|
};
|
|
48530
|
-
(0,
|
|
48626
|
+
(0, import_fs24.writeFileSync)(statePath, JSON.stringify(state, null, 2), "utf-8");
|
|
48531
48627
|
}
|
|
48532
48628
|
function writeSyncState(orgName, localHash, approvedHash, version2, syncedFiles = [], policyName, hookSettings) {
|
|
48533
48629
|
const platformStates = /* @__PURE__ */ new Map();
|
|
@@ -48583,16 +48679,16 @@ function findChangedKeys(existing, incoming, prefix = "") {
|
|
|
48583
48679
|
}
|
|
48584
48680
|
function readSyncState() {
|
|
48585
48681
|
const projectRoot = findProjectRoot();
|
|
48586
|
-
const statePath = (0,
|
|
48587
|
-
if (!(0,
|
|
48682
|
+
const statePath = (0, import_path23.join)(projectRoot, ".gal", "sync-state.json");
|
|
48683
|
+
if (!(0, import_fs24.existsSync)(statePath)) {
|
|
48588
48684
|
return null;
|
|
48589
48685
|
}
|
|
48590
48686
|
try {
|
|
48591
|
-
const content = (0,
|
|
48687
|
+
const content = (0, import_fs24.readFileSync)(statePath, "utf-8");
|
|
48592
48688
|
const rawState = JSON.parse(content);
|
|
48593
48689
|
if (!rawState.schemaVersion) {
|
|
48594
48690
|
const migratedState = migrateSyncStateV1ToV2(rawState);
|
|
48595
|
-
(0,
|
|
48691
|
+
(0, import_fs24.writeFileSync)(statePath, JSON.stringify(migratedState, null, 2), "utf-8");
|
|
48596
48692
|
return migratedState;
|
|
48597
48693
|
}
|
|
48598
48694
|
return rawState;
|
|
@@ -48774,32 +48870,32 @@ async function pushLearnings(directory, orgName, apiUrl, headers, options) {
|
|
|
48774
48870
|
} catch {
|
|
48775
48871
|
}
|
|
48776
48872
|
const learningFiles = [];
|
|
48777
|
-
const claudeMdPath = (0,
|
|
48778
|
-
if ((0,
|
|
48873
|
+
const claudeMdPath = (0, import_path23.join)(directory, ".claude", "CLAUDE.md");
|
|
48874
|
+
if ((0, import_fs24.existsSync)(claudeMdPath)) {
|
|
48779
48875
|
learningFiles.push({ path: claudeMdPath, type: "instruction" });
|
|
48780
48876
|
}
|
|
48781
|
-
const rootClaudeMdPath = (0,
|
|
48782
|
-
if ((0,
|
|
48877
|
+
const rootClaudeMdPath = (0, import_path23.join)(directory, "CLAUDE.md");
|
|
48878
|
+
if ((0, import_fs24.existsSync)(rootClaudeMdPath)) {
|
|
48783
48879
|
learningFiles.push({ path: rootClaudeMdPath, type: "memory" });
|
|
48784
48880
|
}
|
|
48785
|
-
const rulesDir = (0,
|
|
48786
|
-
if ((0,
|
|
48787
|
-
const ruleFiles = (0,
|
|
48881
|
+
const rulesDir = (0, import_path23.join)(directory, ".claude", "rules");
|
|
48882
|
+
if ((0, import_fs24.existsSync)(rulesDir)) {
|
|
48883
|
+
const ruleFiles = (0, import_fs24.readdirSync)(rulesDir).filter((f) => f.endsWith(".md"));
|
|
48788
48884
|
for (const file of ruleFiles) {
|
|
48789
|
-
learningFiles.push({ path: (0,
|
|
48885
|
+
learningFiles.push({ path: (0, import_path23.join)(rulesDir, file), type: "instruction" });
|
|
48790
48886
|
}
|
|
48791
48887
|
}
|
|
48792
|
-
const commandsDir = (0,
|
|
48793
|
-
if ((0,
|
|
48794
|
-
const cmdFiles = (0,
|
|
48888
|
+
const commandsDir = (0, import_path23.join)(directory, ".claude", "commands");
|
|
48889
|
+
if ((0, import_fs24.existsSync)(commandsDir)) {
|
|
48890
|
+
const cmdFiles = (0, import_fs24.readdirSync)(commandsDir).filter((f) => f.endsWith(".md"));
|
|
48795
48891
|
for (const file of cmdFiles) {
|
|
48796
|
-
learningFiles.push({ path: (0,
|
|
48892
|
+
learningFiles.push({ path: (0, import_path23.join)(commandsDir, file), type: "command" });
|
|
48797
48893
|
}
|
|
48798
48894
|
}
|
|
48799
48895
|
spinner.text = `Found ${learningFiles.length} source files, extracting learnings...`;
|
|
48800
48896
|
const learnings = [];
|
|
48801
48897
|
for (const { path: path8, type } of learningFiles) {
|
|
48802
|
-
const content = (0,
|
|
48898
|
+
const content = (0, import_fs24.readFileSync)(path8, "utf-8");
|
|
48803
48899
|
const relPath = path8.replace(directory + "/", "");
|
|
48804
48900
|
const learningPattern = /^##\s+(.*(?:Learning|Anti-pattern|Best Practice|CRITICAL).*?)$/i;
|
|
48805
48901
|
const hasLearnings = content.match(new RegExp(learningPattern.source, "im"));
|
|
@@ -49048,6 +49144,9 @@ function createSyncCommand() {
|
|
|
49048
49144
|
command.argument("[orgName]", "Organization name (uses default if not specified)").option("-d, --directory <path>", "Local config directory (auto-detects project root)", process.cwd()).option("-p, --platform <platform>", "Filter by platform (claude, cursor, etc.)").option("--pull", "Download CISO-approved config to local directory").option("--push", "Push session learnings to organization (capture learning pipeline)").option("--repo <name>", "Personal repo to sync from (for users without org)").option("--check", "Check if local files match approved config (for hooks)").option("--regenerate", "Regenerate native configs from canonical .gal/ directory (offline)").option("--auto", "Non-interactive mode for hooks/scripts (no prompts, exit cleanly)").option("--output-json", "Output as JSON").option("--dry-run", "Preview what would be pushed without making API calls").option("--target <target>", "Sync specific target: configs (default), domains (domain allowlist)").action(async (orgName, options) => {
|
|
49049
49145
|
try {
|
|
49050
49146
|
const directory = findProjectRoot(options.directory);
|
|
49147
|
+
if (options.pull && options.auto && !shouldRunAutoSync(directory, options.directory || process.cwd())) {
|
|
49148
|
+
process.exit(0);
|
|
49149
|
+
}
|
|
49051
49150
|
if (options.regenerate) {
|
|
49052
49151
|
await regenerateFromCanonical(directory, options.platform);
|
|
49053
49152
|
process.exit(0);
|
|
@@ -49091,30 +49190,30 @@ function createSyncCommand() {
|
|
|
49091
49190
|
}
|
|
49092
49191
|
const allowlist = await res.json();
|
|
49093
49192
|
spinner2.succeed(source_default.green("Domain allowlist fetched"));
|
|
49094
|
-
const galDir = (0,
|
|
49095
|
-
if (!(0,
|
|
49096
|
-
(0,
|
|
49193
|
+
const galDir = (0, import_path23.join)(directory, ".gal");
|
|
49194
|
+
if (!(0, import_fs24.existsSync)(galDir)) {
|
|
49195
|
+
(0, import_fs24.mkdirSync)(galDir, { recursive: true });
|
|
49097
49196
|
}
|
|
49098
|
-
const allowlistPath = (0,
|
|
49099
|
-
(0,
|
|
49197
|
+
const allowlistPath = (0, import_path23.join)(galDir, "domain-allowlist.json");
|
|
49198
|
+
(0, import_fs24.writeFileSync)(allowlistPath, JSON.stringify(allowlist, null, 2) + "\n", "utf-8");
|
|
49100
49199
|
console.log(source_default.green(`
|
|
49101
49200
|
Synced domain allowlist to .gal/domain-allowlist.json`));
|
|
49102
49201
|
console.log(source_default.dim(` Domains: ${allowlist.allowedDomains?.length || 0}`));
|
|
49103
49202
|
console.log(source_default.dim(` MCP endpoints: ${allowlist.allowedMcpEndpoints?.length || 0}`));
|
|
49104
49203
|
console.log(source_default.dim(` Enforced: ${allowlist.enforced ? "yes" : "no (audit-only)"}`));
|
|
49105
|
-
const policiesDir = (0,
|
|
49106
|
-
if ((0,
|
|
49107
|
-
if (!(0,
|
|
49108
|
-
(0,
|
|
49204
|
+
const policiesDir = (0, import_path23.join)(directory, ".github", "policies");
|
|
49205
|
+
if ((0, import_fs24.existsSync)((0, import_path23.join)(directory, ".github"))) {
|
|
49206
|
+
if (!(0, import_fs24.existsSync)(policiesDir)) {
|
|
49207
|
+
(0, import_fs24.mkdirSync)(policiesDir, { recursive: true });
|
|
49109
49208
|
}
|
|
49110
|
-
const policyPath = (0,
|
|
49209
|
+
const policyPath = (0, import_path23.join)(policiesDir, "domain-allowlist.json");
|
|
49111
49210
|
const policyContent = {
|
|
49112
49211
|
version: allowlist.version || 1,
|
|
49113
49212
|
approvedDomains: allowlist.allowedDomains || [],
|
|
49114
49213
|
approvedMcpEndpoints: allowlist.allowedMcpEndpoints || [],
|
|
49115
49214
|
description: "Domains approved for AI agent WebFetch/WebSearch access. Managed by GAL org-level policy."
|
|
49116
49215
|
};
|
|
49117
|
-
(0,
|
|
49216
|
+
(0, import_fs24.writeFileSync)(policyPath, JSON.stringify(policyContent, null, 2) + "\n", "utf-8");
|
|
49118
49217
|
console.log(source_default.dim(` Also updated .github/policies/domain-allowlist.json`));
|
|
49119
49218
|
}
|
|
49120
49219
|
console.log();
|
|
@@ -49461,11 +49560,11 @@ function createSyncCommand() {
|
|
|
49461
49560
|
process.exit(0);
|
|
49462
49561
|
}
|
|
49463
49562
|
const directory = findProjectRoot(settingsOpts.directory || process.cwd());
|
|
49464
|
-
const settingsPath = (0,
|
|
49563
|
+
const settingsPath = (0, import_path23.join)(directory, ".claude", "settings.json");
|
|
49465
49564
|
let existingSettings = {};
|
|
49466
|
-
if ((0,
|
|
49565
|
+
if ((0, import_fs24.existsSync)(settingsPath)) {
|
|
49467
49566
|
try {
|
|
49468
|
-
existingSettings = JSON.parse((0,
|
|
49567
|
+
existingSettings = JSON.parse((0, import_fs24.readFileSync)(settingsPath, "utf-8"));
|
|
49469
49568
|
} catch {
|
|
49470
49569
|
console.error(source_default.red("Error: Could not parse existing .claude/settings.json"));
|
|
49471
49570
|
process.exit(1);
|
|
@@ -49501,11 +49600,11 @@ function createSyncCommand() {
|
|
|
49501
49600
|
deny: mergedDeny
|
|
49502
49601
|
}
|
|
49503
49602
|
};
|
|
49504
|
-
const claudeDir = (0,
|
|
49505
|
-
if (!(0,
|
|
49506
|
-
(0,
|
|
49603
|
+
const claudeDir = (0, import_path23.join)(directory, ".claude");
|
|
49604
|
+
if (!(0, import_fs24.existsSync)(claudeDir)) {
|
|
49605
|
+
(0, import_fs24.mkdirSync)(claudeDir, { recursive: true });
|
|
49507
49606
|
}
|
|
49508
|
-
(0,
|
|
49607
|
+
(0, import_fs24.writeFileSync)(settingsPath, JSON.stringify(merged, null, 2) + "\n", "utf-8");
|
|
49509
49608
|
console.log(source_default.green(`
|
|
49510
49609
|
\u2714 Added ${added.length} deny rule(s) to ${settingsPath}`));
|
|
49511
49610
|
for (const rule of added) {
|
|
@@ -49524,67 +49623,67 @@ function scanLocalConfigs(directory, platformFilter) {
|
|
|
49524
49623
|
for (const platform5 of platforms) {
|
|
49525
49624
|
if (platformFilter && platform5 !== platformFilter) continue;
|
|
49526
49625
|
const platformDir = getPlatformDirectory(platform5);
|
|
49527
|
-
const fullPath = (0,
|
|
49528
|
-
if (!(0,
|
|
49626
|
+
const fullPath = (0, import_path23.join)(directory, platformDir);
|
|
49627
|
+
if (!(0, import_fs24.existsSync)(fullPath)) continue;
|
|
49529
49628
|
const files = [];
|
|
49530
|
-
const settingsPath = (0,
|
|
49531
|
-
if ((0,
|
|
49629
|
+
const settingsPath = (0, import_path23.join)(fullPath, "settings.json");
|
|
49630
|
+
if ((0, import_fs24.existsSync)(settingsPath)) {
|
|
49532
49631
|
files.push({
|
|
49533
49632
|
path: settingsPath,
|
|
49534
49633
|
type: "settings",
|
|
49535
|
-
content: (0,
|
|
49634
|
+
content: (0, import_fs24.readFileSync)(settingsPath, "utf-8")
|
|
49536
49635
|
});
|
|
49537
49636
|
}
|
|
49538
|
-
const rulesDir = (0,
|
|
49539
|
-
if ((0,
|
|
49540
|
-
const ruleFiles = (0,
|
|
49637
|
+
const rulesDir = (0, import_path23.join)(fullPath, "rules");
|
|
49638
|
+
if ((0, import_fs24.existsSync)(rulesDir)) {
|
|
49639
|
+
const ruleFiles = (0, import_fs24.readdirSync)(rulesDir).filter(
|
|
49541
49640
|
(f) => f.endsWith(".md") || f.endsWith(".mdc")
|
|
49542
49641
|
);
|
|
49543
49642
|
for (const file of ruleFiles) {
|
|
49544
|
-
const filePath = (0,
|
|
49643
|
+
const filePath = (0, import_path23.join)(rulesDir, file);
|
|
49545
49644
|
files.push({
|
|
49546
49645
|
path: filePath,
|
|
49547
49646
|
type: "rule",
|
|
49548
|
-
content: (0,
|
|
49647
|
+
content: (0, import_fs24.readFileSync)(filePath, "utf-8")
|
|
49549
49648
|
});
|
|
49550
49649
|
}
|
|
49551
49650
|
}
|
|
49552
49651
|
if (platform5 === "cursor") {
|
|
49553
|
-
const cursorRulesPath = (0,
|
|
49554
|
-
if ((0,
|
|
49652
|
+
const cursorRulesPath = (0, import_path23.join)(directory, ".cursorrules");
|
|
49653
|
+
if ((0, import_fs24.existsSync)(cursorRulesPath)) {
|
|
49555
49654
|
files.push({
|
|
49556
49655
|
path: cursorRulesPath,
|
|
49557
49656
|
type: "rule",
|
|
49558
|
-
content: (0,
|
|
49657
|
+
content: (0, import_fs24.readFileSync)(cursorRulesPath, "utf-8")
|
|
49559
49658
|
});
|
|
49560
49659
|
}
|
|
49561
49660
|
}
|
|
49562
49661
|
if (platform5 === "claude") {
|
|
49563
|
-
const commandsDir = (0,
|
|
49564
|
-
if ((0,
|
|
49565
|
-
const commandFiles = (0,
|
|
49662
|
+
const commandsDir = (0, import_path23.join)(fullPath, "commands");
|
|
49663
|
+
if ((0, import_fs24.existsSync)(commandsDir)) {
|
|
49664
|
+
const commandFiles = (0, import_fs24.readdirSync)(commandsDir).filter(
|
|
49566
49665
|
(f) => f.endsWith(".md")
|
|
49567
49666
|
);
|
|
49568
49667
|
for (const file of commandFiles) {
|
|
49569
|
-
const filePath = (0,
|
|
49668
|
+
const filePath = (0, import_path23.join)(commandsDir, file);
|
|
49570
49669
|
files.push({
|
|
49571
49670
|
path: filePath,
|
|
49572
49671
|
type: "command",
|
|
49573
|
-
content: (0,
|
|
49672
|
+
content: (0, import_fs24.readFileSync)(filePath, "utf-8")
|
|
49574
49673
|
});
|
|
49575
49674
|
}
|
|
49576
49675
|
}
|
|
49577
|
-
const hooksDir = (0,
|
|
49578
|
-
if ((0,
|
|
49579
|
-
const hookFiles = (0,
|
|
49676
|
+
const hooksDir = (0, import_path23.join)(fullPath, "hooks");
|
|
49677
|
+
if ((0, import_fs24.existsSync)(hooksDir)) {
|
|
49678
|
+
const hookFiles = (0, import_fs24.readdirSync)(hooksDir).filter(
|
|
49580
49679
|
(f) => f.endsWith(".py") || f.endsWith(".sh")
|
|
49581
49680
|
);
|
|
49582
49681
|
for (const file of hookFiles) {
|
|
49583
|
-
const filePath = (0,
|
|
49682
|
+
const filePath = (0, import_path23.join)(hooksDir, file);
|
|
49584
49683
|
files.push({
|
|
49585
49684
|
path: filePath,
|
|
49586
49685
|
type: "hook",
|
|
49587
|
-
content: (0,
|
|
49686
|
+
content: (0, import_fs24.readFileSync)(filePath, "utf-8")
|
|
49588
49687
|
});
|
|
49589
49688
|
}
|
|
49590
49689
|
}
|
|
@@ -49697,16 +49796,16 @@ Sync Status for ${orgName}:
|
|
|
49697
49796
|
}
|
|
49698
49797
|
}
|
|
49699
49798
|
function writeCursorConfig(directory, configData, syncedFiles, syncedItems) {
|
|
49700
|
-
const cursorDir = (0,
|
|
49799
|
+
const cursorDir = (0, import_path23.join)(directory, ".cursor");
|
|
49701
49800
|
if (configData.rules && configData.rules.length > 0) {
|
|
49702
|
-
const rulesDir = (0,
|
|
49703
|
-
if (!(0,
|
|
49704
|
-
(0,
|
|
49801
|
+
const rulesDir = (0, import_path23.join)(cursorDir, "rules");
|
|
49802
|
+
if (!(0, import_fs24.existsSync)(rulesDir)) {
|
|
49803
|
+
(0, import_fs24.mkdirSync)(rulesDir, { recursive: true });
|
|
49705
49804
|
}
|
|
49706
49805
|
for (const rule of configData.rules) {
|
|
49707
49806
|
const fileName = rule.name.endsWith(".mdc") || rule.name.endsWith(".md") ? rule.name : `${rule.name}.mdc`;
|
|
49708
|
-
const filePath = (0,
|
|
49709
|
-
(0,
|
|
49807
|
+
const filePath = (0, import_path23.join)(rulesDir, fileName);
|
|
49808
|
+
(0, import_fs24.writeFileSync)(filePath, rule.content, "utf-8");
|
|
49710
49809
|
const relativePath = `.cursor/rules/${fileName}`;
|
|
49711
49810
|
syncedFiles.push(relativePath);
|
|
49712
49811
|
syncedItems.push({
|
|
@@ -49718,8 +49817,8 @@ function writeCursorConfig(directory, configData, syncedFiles, syncedItems) {
|
|
|
49718
49817
|
}
|
|
49719
49818
|
}
|
|
49720
49819
|
if (configData.cursorRules?.content) {
|
|
49721
|
-
const cursorRulesPath = (0,
|
|
49722
|
-
(0,
|
|
49820
|
+
const cursorRulesPath = (0, import_path23.join)(directory, ".cursorrules");
|
|
49821
|
+
(0, import_fs24.writeFileSync)(cursorRulesPath, configData.cursorRules.content, "utf-8");
|
|
49723
49822
|
syncedFiles.push(".cursorrules");
|
|
49724
49823
|
syncedItems.push({
|
|
49725
49824
|
path: ".cursorrules",
|
|
@@ -49729,11 +49828,11 @@ function writeCursorConfig(directory, configData, syncedFiles, syncedItems) {
|
|
|
49729
49828
|
});
|
|
49730
49829
|
}
|
|
49731
49830
|
if (configData.settings?.content) {
|
|
49732
|
-
if (!(0,
|
|
49733
|
-
(0,
|
|
49831
|
+
if (!(0, import_fs24.existsSync)(cursorDir)) {
|
|
49832
|
+
(0, import_fs24.mkdirSync)(cursorDir, { recursive: true });
|
|
49734
49833
|
}
|
|
49735
|
-
const settingsPath = (0,
|
|
49736
|
-
(0,
|
|
49834
|
+
const settingsPath = (0, import_path23.join)(cursorDir, "settings.json");
|
|
49835
|
+
(0, import_fs24.writeFileSync)(settingsPath, configData.settings.content, "utf-8");
|
|
49737
49836
|
syncedFiles.push(".cursor/settings.json");
|
|
49738
49837
|
syncedItems.push({
|
|
49739
49838
|
path: ".cursor/settings.json",
|
|
@@ -49744,10 +49843,10 @@ function writeCursorConfig(directory, configData, syncedFiles, syncedItems) {
|
|
|
49744
49843
|
}
|
|
49745
49844
|
}
|
|
49746
49845
|
function writeClaudeConfig(directory, configData, syncedFiles, syncedItems, orgName) {
|
|
49747
|
-
const claudeDir = (0,
|
|
49846
|
+
const claudeDir = (0, import_path23.join)(directory, ".claude");
|
|
49748
49847
|
if (configData.instructions?.content) {
|
|
49749
|
-
const claudeMdPath = (0,
|
|
49750
|
-
(0,
|
|
49848
|
+
const claudeMdPath = (0, import_path23.join)(directory, "CLAUDE.md");
|
|
49849
|
+
(0, import_fs24.writeFileSync)(claudeMdPath, configData.instructions.content, "utf-8");
|
|
49751
49850
|
syncedFiles.push("CLAUDE.md");
|
|
49752
49851
|
syncedItems.push({
|
|
49753
49852
|
path: "CLAUDE.md",
|
|
@@ -49757,19 +49856,19 @@ function writeClaudeConfig(directory, configData, syncedFiles, syncedItems, orgN
|
|
|
49757
49856
|
});
|
|
49758
49857
|
}
|
|
49759
49858
|
if (configData.commands && configData.commands.length > 0) {
|
|
49760
|
-
const commandsDir = (0,
|
|
49761
|
-
if (!(0,
|
|
49762
|
-
(0,
|
|
49859
|
+
const commandsDir = (0, import_path23.join)(claudeDir, "commands");
|
|
49860
|
+
if (!(0, import_fs24.existsSync)(commandsDir)) {
|
|
49861
|
+
(0, import_fs24.mkdirSync)(commandsDir, { recursive: true });
|
|
49763
49862
|
}
|
|
49764
49863
|
for (const cmd of configData.commands) {
|
|
49765
49864
|
const pathFromName = cmd.name.replace(/:/g, "/");
|
|
49766
49865
|
const fileName = pathFromName.endsWith(".md") ? pathFromName : `${pathFromName}.md`;
|
|
49767
|
-
const filePath = (0,
|
|
49768
|
-
const fileDir = (0,
|
|
49769
|
-
if (!(0,
|
|
49770
|
-
(0,
|
|
49866
|
+
const filePath = (0, import_path23.join)(commandsDir, fileName);
|
|
49867
|
+
const fileDir = (0, import_path23.dirname)(filePath);
|
|
49868
|
+
if (!(0, import_fs24.existsSync)(fileDir)) {
|
|
49869
|
+
(0, import_fs24.mkdirSync)(fileDir, { recursive: true });
|
|
49771
49870
|
}
|
|
49772
|
-
(0,
|
|
49871
|
+
(0, import_fs24.writeFileSync)(filePath, cmd.content, "utf-8");
|
|
49773
49872
|
const relativePath = `.claude/commands/${fileName}`;
|
|
49774
49873
|
syncedFiles.push(relativePath);
|
|
49775
49874
|
const { description, allowedTools } = parseCommandFrontmatter(cmd.content);
|
|
@@ -49784,13 +49883,13 @@ function writeClaudeConfig(directory, configData, syncedFiles, syncedItems, orgN
|
|
|
49784
49883
|
}
|
|
49785
49884
|
}
|
|
49786
49885
|
if (configData.hooks && configData.hooks.length > 0) {
|
|
49787
|
-
const hooksDir = (0,
|
|
49788
|
-
if (!(0,
|
|
49789
|
-
(0,
|
|
49886
|
+
const hooksDir = (0, import_path23.join)(claudeDir, "hooks");
|
|
49887
|
+
if (!(0, import_fs24.existsSync)(hooksDir)) {
|
|
49888
|
+
(0, import_fs24.mkdirSync)(hooksDir, { recursive: true });
|
|
49790
49889
|
}
|
|
49791
49890
|
for (const hook of configData.hooks) {
|
|
49792
|
-
const filePath = (0,
|
|
49793
|
-
(0,
|
|
49891
|
+
const filePath = (0, import_path23.join)(hooksDir, hook.name);
|
|
49892
|
+
(0, import_fs24.writeFileSync)(filePath, hook.content, "utf-8");
|
|
49794
49893
|
const relativePath = `.claude/hooks/${hook.name}`;
|
|
49795
49894
|
syncedFiles.push(relativePath);
|
|
49796
49895
|
syncedItems.push({
|
|
@@ -49802,18 +49901,18 @@ function writeClaudeConfig(directory, configData, syncedFiles, syncedItems, orgN
|
|
|
49802
49901
|
}
|
|
49803
49902
|
}
|
|
49804
49903
|
if (configData.settings?.content) {
|
|
49805
|
-
if (!(0,
|
|
49806
|
-
(0,
|
|
49904
|
+
if (!(0, import_fs24.existsSync)(claudeDir)) {
|
|
49905
|
+
(0, import_fs24.mkdirSync)(claudeDir, { recursive: true });
|
|
49807
49906
|
}
|
|
49808
|
-
const settingsPath = (0,
|
|
49809
|
-
if ((0,
|
|
49810
|
-
const existingContent = (0,
|
|
49907
|
+
const settingsPath = (0, import_path23.join)(claudeDir, "settings.json");
|
|
49908
|
+
if ((0, import_fs24.existsSync)(settingsPath)) {
|
|
49909
|
+
const existingContent = (0, import_fs24.readFileSync)(settingsPath, "utf-8");
|
|
49811
49910
|
const newContent = configData.settings.content;
|
|
49812
49911
|
const existingHash = calculateConfigHash(existingContent);
|
|
49813
49912
|
const newHash = calculateConfigHash(newContent);
|
|
49814
49913
|
if (existingHash !== newHash) {
|
|
49815
49914
|
const backupPath = `${settingsPath}.bak`;
|
|
49816
|
-
(0,
|
|
49915
|
+
(0, import_fs24.writeFileSync)(backupPath, existingContent, "utf-8");
|
|
49817
49916
|
console.log(source_default.yellow("\n Settings changes detected:"));
|
|
49818
49917
|
try {
|
|
49819
49918
|
const existingParsed = JSON.parse(existingContent);
|
|
@@ -49834,20 +49933,20 @@ function writeClaudeConfig(directory, configData, syncedFiles, syncedItems, orgN
|
|
|
49834
49933
|
console.log();
|
|
49835
49934
|
}
|
|
49836
49935
|
}
|
|
49837
|
-
const userSettingsPath = (0,
|
|
49838
|
-
if ((0,
|
|
49839
|
-
const userContent = (0,
|
|
49936
|
+
const userSettingsPath = (0, import_path23.join)((0, import_os18.homedir)(), ".claude", "settings.json");
|
|
49937
|
+
if ((0, import_fs24.existsSync)(userSettingsPath)) {
|
|
49938
|
+
const userContent = (0, import_fs24.readFileSync)(userSettingsPath, "utf-8");
|
|
49840
49939
|
const userHash = calculateConfigHash(userContent);
|
|
49841
49940
|
const orgHash = calculateConfigHash(configData.settings.content);
|
|
49842
49941
|
if (userHash !== orgHash) {
|
|
49843
49942
|
const userBackupPath = `${userSettingsPath}.bak`;
|
|
49844
|
-
(0,
|
|
49943
|
+
(0, import_fs24.writeFileSync)(userBackupPath, userContent, "utf-8");
|
|
49845
49944
|
console.log(source_default.yellow(" User-level settings differ from org baseline."));
|
|
49846
49945
|
console.log(source_default.dim(` Backup: ${userBackupPath}`));
|
|
49847
49946
|
console.log();
|
|
49848
49947
|
}
|
|
49849
49948
|
}
|
|
49850
|
-
(0,
|
|
49949
|
+
(0, import_fs24.writeFileSync)(settingsPath, configData.settings.content, "utf-8");
|
|
49851
49950
|
syncedFiles.push(".claude/settings.json");
|
|
49852
49951
|
syncedItems.push({
|
|
49853
49952
|
path: ".claude/settings.json",
|
|
@@ -49857,19 +49956,19 @@ function writeClaudeConfig(directory, configData, syncedFiles, syncedItems, orgN
|
|
|
49857
49956
|
});
|
|
49858
49957
|
}
|
|
49859
49958
|
if (configData.subagents && configData.subagents.length > 0) {
|
|
49860
|
-
const agentsDir = (0,
|
|
49861
|
-
if (!(0,
|
|
49862
|
-
(0,
|
|
49959
|
+
const agentsDir = (0, import_path23.join)(claudeDir, "agents");
|
|
49960
|
+
if (!(0, import_fs24.existsSync)(agentsDir)) {
|
|
49961
|
+
(0, import_fs24.mkdirSync)(agentsDir, { recursive: true });
|
|
49863
49962
|
}
|
|
49864
49963
|
for (const agent of configData.subagents) {
|
|
49865
49964
|
const pathFromName = agent.name.replace(/:/g, "/");
|
|
49866
49965
|
const fileName = pathFromName.endsWith(".md") ? pathFromName : `${pathFromName}.md`;
|
|
49867
|
-
const filePath = (0,
|
|
49868
|
-
const fileDir = (0,
|
|
49869
|
-
if (!(0,
|
|
49870
|
-
(0,
|
|
49966
|
+
const filePath = (0, import_path23.join)(agentsDir, fileName);
|
|
49967
|
+
const fileDir = (0, import_path23.dirname)(filePath);
|
|
49968
|
+
if (!(0, import_fs24.existsSync)(fileDir)) {
|
|
49969
|
+
(0, import_fs24.mkdirSync)(fileDir, { recursive: true });
|
|
49871
49970
|
}
|
|
49872
|
-
(0,
|
|
49971
|
+
(0, import_fs24.writeFileSync)(filePath, agent.content, "utf-8");
|
|
49873
49972
|
const relativePath = `.claude/agents/${fileName}`;
|
|
49874
49973
|
syncedFiles.push(relativePath);
|
|
49875
49974
|
const { description } = parseCommandFrontmatter(agent.content);
|
|
@@ -49883,17 +49982,17 @@ function writeClaudeConfig(directory, configData, syncedFiles, syncedItems, orgN
|
|
|
49883
49982
|
}
|
|
49884
49983
|
}
|
|
49885
49984
|
if (configData.skills && configData.skills.length > 0) {
|
|
49886
|
-
const skillsDir = (0,
|
|
49887
|
-
if (!(0,
|
|
49888
|
-
(0,
|
|
49985
|
+
const skillsDir = (0, import_path23.join)(claudeDir, "skills");
|
|
49986
|
+
if (!(0, import_fs24.existsSync)(skillsDir)) {
|
|
49987
|
+
(0, import_fs24.mkdirSync)(skillsDir, { recursive: true });
|
|
49889
49988
|
}
|
|
49890
49989
|
for (const skill of configData.skills) {
|
|
49891
|
-
const skillDir = (0,
|
|
49892
|
-
if (!(0,
|
|
49893
|
-
(0,
|
|
49990
|
+
const skillDir = (0, import_path23.join)(skillsDir, skill.name);
|
|
49991
|
+
if (!(0, import_fs24.existsSync)(skillDir)) {
|
|
49992
|
+
(0, import_fs24.mkdirSync)(skillDir, { recursive: true });
|
|
49894
49993
|
}
|
|
49895
|
-
const skillPath = (0,
|
|
49896
|
-
(0,
|
|
49994
|
+
const skillPath = (0, import_path23.join)(skillDir, "SKILL.md");
|
|
49995
|
+
(0, import_fs24.writeFileSync)(skillPath, skill.content, "utf-8");
|
|
49897
49996
|
const relativePath = `.claude/skills/${skill.name}/SKILL.md`;
|
|
49898
49997
|
syncedFiles.push(relativePath);
|
|
49899
49998
|
syncedItems.push({
|
|
@@ -49906,14 +50005,14 @@ function writeClaudeConfig(directory, configData, syncedFiles, syncedItems, orgN
|
|
|
49906
50005
|
}
|
|
49907
50006
|
}
|
|
49908
50007
|
if (configData.rules && configData.rules.length > 0) {
|
|
49909
|
-
const rulesDir = (0,
|
|
49910
|
-
if (!(0,
|
|
49911
|
-
(0,
|
|
50008
|
+
const rulesDir = (0, import_path23.join)(claudeDir, "rules");
|
|
50009
|
+
if (!(0, import_fs24.existsSync)(rulesDir)) {
|
|
50010
|
+
(0, import_fs24.mkdirSync)(rulesDir, { recursive: true });
|
|
49912
50011
|
}
|
|
49913
50012
|
for (const rule of configData.rules) {
|
|
49914
50013
|
const fileName = rule.name.endsWith(".md") ? rule.name : `${rule.name}.md`;
|
|
49915
|
-
const filePath = (0,
|
|
49916
|
-
(0,
|
|
50014
|
+
const filePath = (0, import_path23.join)(rulesDir, fileName);
|
|
50015
|
+
(0, import_fs24.writeFileSync)(filePath, rule.content, "utf-8");
|
|
49917
50016
|
const relativePath = `.claude/rules/${fileName}`;
|
|
49918
50017
|
syncedFiles.push(relativePath);
|
|
49919
50018
|
syncedItems.push({
|
|
@@ -49926,23 +50025,23 @@ function writeClaudeConfig(directory, configData, syncedFiles, syncedItems, orgN
|
|
|
49926
50025
|
}
|
|
49927
50026
|
}
|
|
49928
50027
|
function writeCodexConfig(directory, configData, syncedFiles, syncedItems) {
|
|
49929
|
-
const codexDir = (0,
|
|
49930
|
-
const codexDirExists = (0,
|
|
50028
|
+
const codexDir = (0, import_path23.join)(directory, ".codex");
|
|
50029
|
+
const codexDirExists = (0, import_fs24.existsSync)(codexDir);
|
|
49931
50030
|
if (!codexDirExists) {
|
|
49932
50031
|
return;
|
|
49933
50032
|
}
|
|
49934
50033
|
if (configData.skills && configData.skills.length > 0) {
|
|
49935
|
-
const skillsDir = (0,
|
|
49936
|
-
if (!(0,
|
|
49937
|
-
(0,
|
|
50034
|
+
const skillsDir = (0, import_path23.join)(codexDir, "skills");
|
|
50035
|
+
if (!(0, import_fs24.existsSync)(skillsDir)) {
|
|
50036
|
+
(0, import_fs24.mkdirSync)(skillsDir, { recursive: true });
|
|
49938
50037
|
}
|
|
49939
50038
|
for (const skill of configData.skills) {
|
|
49940
|
-
const skillDir = (0,
|
|
49941
|
-
if (!(0,
|
|
49942
|
-
(0,
|
|
50039
|
+
const skillDir = (0, import_path23.join)(skillsDir, skill.name);
|
|
50040
|
+
if (!(0, import_fs24.existsSync)(skillDir)) {
|
|
50041
|
+
(0, import_fs24.mkdirSync)(skillDir, { recursive: true });
|
|
49943
50042
|
}
|
|
49944
|
-
const skillPath = (0,
|
|
49945
|
-
(0,
|
|
50043
|
+
const skillPath = (0, import_path23.join)(skillDir, "SKILL.md");
|
|
50044
|
+
(0, import_fs24.writeFileSync)(skillPath, skill.content, "utf-8");
|
|
49946
50045
|
const relativePath = `.codex/skills/${skill.name}/SKILL.md`;
|
|
49947
50046
|
syncedFiles.push(relativePath);
|
|
49948
50047
|
syncedItems.push({
|
|
@@ -49954,8 +50053,8 @@ function writeCodexConfig(directory, configData, syncedFiles, syncedItems) {
|
|
|
49954
50053
|
}
|
|
49955
50054
|
}
|
|
49956
50055
|
if (configData.settings?.content) {
|
|
49957
|
-
const settingsPath = (0,
|
|
49958
|
-
(0,
|
|
50056
|
+
const settingsPath = (0, import_path23.join)(codexDir, "settings.json");
|
|
50057
|
+
(0, import_fs24.writeFileSync)(settingsPath, configData.settings.content, "utf-8");
|
|
49959
50058
|
syncedFiles.push(".codex/settings.json");
|
|
49960
50059
|
syncedItems.push({
|
|
49961
50060
|
path: ".codex/settings.json",
|
|
@@ -49971,15 +50070,15 @@ function codexPromptFileNameFromCommand(commandName) {
|
|
|
49971
50070
|
}
|
|
49972
50071
|
function writeCodexPrompts(commands) {
|
|
49973
50072
|
if (!commands || commands.length === 0) return 0;
|
|
49974
|
-
const promptsDir = (0,
|
|
49975
|
-
if (!(0,
|
|
49976
|
-
(0,
|
|
50073
|
+
const promptsDir = (0, import_path23.join)((0, import_os18.homedir)(), ".codex", "prompts");
|
|
50074
|
+
if (!(0, import_fs24.existsSync)(promptsDir)) {
|
|
50075
|
+
(0, import_fs24.mkdirSync)(promptsDir, { recursive: true });
|
|
49977
50076
|
}
|
|
49978
50077
|
let written = 0;
|
|
49979
50078
|
for (const command of commands) {
|
|
49980
50079
|
const fileName = codexPromptFileNameFromCommand(command.name);
|
|
49981
|
-
const filePath = (0,
|
|
49982
|
-
(0,
|
|
50080
|
+
const filePath = (0, import_path23.join)(promptsDir, fileName);
|
|
50081
|
+
(0, import_fs24.writeFileSync)(filePath, command.content, "utf-8");
|
|
49983
50082
|
written += 1;
|
|
49984
50083
|
}
|
|
49985
50084
|
return written;
|
|
@@ -50011,119 +50110,119 @@ function writeGeminiCommandsAndSkills(directory, configData) {
|
|
|
50011
50110
|
let commandsWritten = 0;
|
|
50012
50111
|
let skillsWritten = 0;
|
|
50013
50112
|
if (configData.commands && configData.commands.length > 0) {
|
|
50014
|
-
const commandsDir = (0,
|
|
50015
|
-
if (!(0,
|
|
50016
|
-
(0,
|
|
50113
|
+
const commandsDir = (0, import_path23.join)(directory, GEMINI_COMMANDS_DIR);
|
|
50114
|
+
if (!(0, import_fs24.existsSync)(commandsDir)) {
|
|
50115
|
+
(0, import_fs24.mkdirSync)(commandsDir, { recursive: true });
|
|
50017
50116
|
}
|
|
50018
50117
|
for (const cmd of configData.commands) {
|
|
50019
50118
|
const pathFromName = cmd.name.replace(/:/g, "/");
|
|
50020
|
-
const filePath = (0,
|
|
50021
|
-
const fileDir = (0,
|
|
50022
|
-
if (!(0,
|
|
50023
|
-
(0,
|
|
50119
|
+
const filePath = (0, import_path23.join)(commandsDir, `${pathFromName}.toml`);
|
|
50120
|
+
const fileDir = (0, import_path23.dirname)(filePath);
|
|
50121
|
+
if (!(0, import_fs24.existsSync)(fileDir)) {
|
|
50122
|
+
(0, import_fs24.mkdirSync)(fileDir, { recursive: true });
|
|
50024
50123
|
}
|
|
50025
50124
|
const description = extractDescription2(cmd.content);
|
|
50026
50125
|
const toml = buildGeminiCommandToml(cmd.name, description, cmd.content);
|
|
50027
|
-
(0,
|
|
50126
|
+
(0, import_fs24.writeFileSync)(filePath, toml, "utf-8");
|
|
50028
50127
|
commandsWritten += 1;
|
|
50029
50128
|
}
|
|
50030
50129
|
}
|
|
50031
50130
|
if (configData.skills && configData.skills.length > 0) {
|
|
50032
|
-
const skillsDir = (0,
|
|
50033
|
-
if (!(0,
|
|
50034
|
-
(0,
|
|
50131
|
+
const skillsDir = (0, import_path23.join)(directory, GEMINI_SKILLS_DIR);
|
|
50132
|
+
if (!(0, import_fs24.existsSync)(skillsDir)) {
|
|
50133
|
+
(0, import_fs24.mkdirSync)(skillsDir, { recursive: true });
|
|
50035
50134
|
}
|
|
50036
50135
|
for (const skill of configData.skills) {
|
|
50037
|
-
const skillDir = (0,
|
|
50038
|
-
if (!(0,
|
|
50039
|
-
(0,
|
|
50136
|
+
const skillDir = (0, import_path23.join)(skillsDir, skill.name);
|
|
50137
|
+
if (!(0, import_fs24.existsSync)(skillDir)) {
|
|
50138
|
+
(0, import_fs24.mkdirSync)(skillDir, { recursive: true });
|
|
50040
50139
|
}
|
|
50041
|
-
const skillPath = (0,
|
|
50042
|
-
(0,
|
|
50140
|
+
const skillPath = (0, import_path23.join)(skillDir, "SKILL.md");
|
|
50141
|
+
(0, import_fs24.writeFileSync)(skillPath, skill.content, "utf-8");
|
|
50043
50142
|
skillsWritten += 1;
|
|
50044
50143
|
}
|
|
50045
50144
|
}
|
|
50046
50145
|
return { commandsWritten, skillsWritten };
|
|
50047
50146
|
}
|
|
50048
50147
|
function writeApprovedClaudeConfig(directory, configData) {
|
|
50049
|
-
const approvedRoot = (0,
|
|
50050
|
-
const approvedClaudeDir = (0,
|
|
50051
|
-
if (!(0,
|
|
50052
|
-
(0,
|
|
50148
|
+
const approvedRoot = (0, import_path23.join)(directory, ".gal", "approved", "claude");
|
|
50149
|
+
const approvedClaudeDir = (0, import_path23.join)(approvedRoot, ".claude");
|
|
50150
|
+
if (!(0, import_fs24.existsSync)(approvedClaudeDir)) {
|
|
50151
|
+
(0, import_fs24.mkdirSync)(approvedClaudeDir, { recursive: true });
|
|
50053
50152
|
}
|
|
50054
50153
|
if (configData.instructions?.content) {
|
|
50055
|
-
const claudeMdPath = (0,
|
|
50056
|
-
(0,
|
|
50154
|
+
const claudeMdPath = (0, import_path23.join)(approvedRoot, "CLAUDE.md");
|
|
50155
|
+
(0, import_fs24.writeFileSync)(claudeMdPath, configData.instructions.content, "utf-8");
|
|
50057
50156
|
}
|
|
50058
50157
|
if (configData.commands && configData.commands.length > 0) {
|
|
50059
|
-
const commandsDir = (0,
|
|
50060
|
-
if (!(0,
|
|
50061
|
-
(0,
|
|
50158
|
+
const commandsDir = (0, import_path23.join)(approvedClaudeDir, "commands");
|
|
50159
|
+
if (!(0, import_fs24.existsSync)(commandsDir)) {
|
|
50160
|
+
(0, import_fs24.mkdirSync)(commandsDir, { recursive: true });
|
|
50062
50161
|
}
|
|
50063
50162
|
for (const cmd of configData.commands) {
|
|
50064
50163
|
const pathFromName = cmd.name.replace(/:/g, "/");
|
|
50065
50164
|
const fileName = pathFromName.endsWith(".md") ? pathFromName : `${pathFromName}.md`;
|
|
50066
|
-
const filePath = (0,
|
|
50067
|
-
const fileDir = (0,
|
|
50068
|
-
if (!(0,
|
|
50069
|
-
(0,
|
|
50165
|
+
const filePath = (0, import_path23.join)(commandsDir, fileName);
|
|
50166
|
+
const fileDir = (0, import_path23.dirname)(filePath);
|
|
50167
|
+
if (!(0, import_fs24.existsSync)(fileDir)) {
|
|
50168
|
+
(0, import_fs24.mkdirSync)(fileDir, { recursive: true });
|
|
50070
50169
|
}
|
|
50071
|
-
(0,
|
|
50170
|
+
(0, import_fs24.writeFileSync)(filePath, cmd.content, "utf-8");
|
|
50072
50171
|
}
|
|
50073
50172
|
}
|
|
50074
50173
|
if (configData.hooks && configData.hooks.length > 0) {
|
|
50075
|
-
const hooksDir = (0,
|
|
50076
|
-
if (!(0,
|
|
50077
|
-
(0,
|
|
50174
|
+
const hooksDir = (0, import_path23.join)(approvedClaudeDir, "hooks");
|
|
50175
|
+
if (!(0, import_fs24.existsSync)(hooksDir)) {
|
|
50176
|
+
(0, import_fs24.mkdirSync)(hooksDir, { recursive: true });
|
|
50078
50177
|
}
|
|
50079
50178
|
for (const hook of configData.hooks) {
|
|
50080
|
-
const filePath = (0,
|
|
50081
|
-
(0,
|
|
50179
|
+
const filePath = (0, import_path23.join)(hooksDir, hook.name);
|
|
50180
|
+
(0, import_fs24.writeFileSync)(filePath, hook.content, "utf-8");
|
|
50082
50181
|
}
|
|
50083
50182
|
}
|
|
50084
50183
|
if (configData.settings?.content) {
|
|
50085
|
-
const settingsPath = (0,
|
|
50086
|
-
(0,
|
|
50184
|
+
const settingsPath = (0, import_path23.join)(approvedClaudeDir, "settings.json");
|
|
50185
|
+
(0, import_fs24.writeFileSync)(settingsPath, configData.settings.content, "utf-8");
|
|
50087
50186
|
}
|
|
50088
50187
|
if (configData.subagents && configData.subagents.length > 0) {
|
|
50089
|
-
const agentsDir = (0,
|
|
50090
|
-
if (!(0,
|
|
50091
|
-
(0,
|
|
50188
|
+
const agentsDir = (0, import_path23.join)(approvedClaudeDir, "agents");
|
|
50189
|
+
if (!(0, import_fs24.existsSync)(agentsDir)) {
|
|
50190
|
+
(0, import_fs24.mkdirSync)(agentsDir, { recursive: true });
|
|
50092
50191
|
}
|
|
50093
50192
|
for (const agent of configData.subagents) {
|
|
50094
50193
|
const pathFromName = agent.name.replace(/:/g, "/");
|
|
50095
50194
|
const fileName = pathFromName.endsWith(".md") ? pathFromName : `${pathFromName}.md`;
|
|
50096
|
-
const filePath = (0,
|
|
50097
|
-
const fileDir = (0,
|
|
50098
|
-
if (!(0,
|
|
50099
|
-
(0,
|
|
50195
|
+
const filePath = (0, import_path23.join)(agentsDir, fileName);
|
|
50196
|
+
const fileDir = (0, import_path23.dirname)(filePath);
|
|
50197
|
+
if (!(0, import_fs24.existsSync)(fileDir)) {
|
|
50198
|
+
(0, import_fs24.mkdirSync)(fileDir, { recursive: true });
|
|
50100
50199
|
}
|
|
50101
|
-
(0,
|
|
50200
|
+
(0, import_fs24.writeFileSync)(filePath, agent.content, "utf-8");
|
|
50102
50201
|
}
|
|
50103
50202
|
}
|
|
50104
50203
|
if (configData.skills && configData.skills.length > 0) {
|
|
50105
|
-
const skillsDir = (0,
|
|
50106
|
-
if (!(0,
|
|
50107
|
-
(0,
|
|
50204
|
+
const skillsDir = (0, import_path23.join)(approvedClaudeDir, "skills");
|
|
50205
|
+
if (!(0, import_fs24.existsSync)(skillsDir)) {
|
|
50206
|
+
(0, import_fs24.mkdirSync)(skillsDir, { recursive: true });
|
|
50108
50207
|
}
|
|
50109
50208
|
for (const skill of configData.skills) {
|
|
50110
|
-
const skillDir = (0,
|
|
50111
|
-
if (!(0,
|
|
50112
|
-
(0,
|
|
50209
|
+
const skillDir = (0, import_path23.join)(skillsDir, skill.name);
|
|
50210
|
+
if (!(0, import_fs24.existsSync)(skillDir)) {
|
|
50211
|
+
(0, import_fs24.mkdirSync)(skillDir, { recursive: true });
|
|
50113
50212
|
}
|
|
50114
|
-
const skillPath = (0,
|
|
50115
|
-
(0,
|
|
50213
|
+
const skillPath = (0, import_path23.join)(skillDir, "SKILL.md");
|
|
50214
|
+
(0, import_fs24.writeFileSync)(skillPath, skill.content, "utf-8");
|
|
50116
50215
|
}
|
|
50117
50216
|
}
|
|
50118
50217
|
if (configData.rules && configData.rules.length > 0) {
|
|
50119
|
-
const rulesDir = (0,
|
|
50120
|
-
if (!(0,
|
|
50121
|
-
(0,
|
|
50218
|
+
const rulesDir = (0, import_path23.join)(approvedClaudeDir, "rules");
|
|
50219
|
+
if (!(0, import_fs24.existsSync)(rulesDir)) {
|
|
50220
|
+
(0, import_fs24.mkdirSync)(rulesDir, { recursive: true });
|
|
50122
50221
|
}
|
|
50123
50222
|
for (const rule of configData.rules) {
|
|
50124
50223
|
const fileName = rule.name.endsWith(".md") ? rule.name : `${rule.name}.md`;
|
|
50125
|
-
const filePath = (0,
|
|
50126
|
-
(0,
|
|
50224
|
+
const filePath = (0, import_path23.join)(rulesDir, fileName);
|
|
50225
|
+
(0, import_fs24.writeFileSync)(filePath, rule.content, "utf-8");
|
|
50127
50226
|
}
|
|
50128
50227
|
}
|
|
50129
50228
|
}
|
|
@@ -50400,20 +50499,20 @@ async function pullApprovedConfig(configRepo, authRepo, orgName, directory, plat
|
|
|
50400
50499
|
} else {
|
|
50401
50500
|
if (configData.configContent) {
|
|
50402
50501
|
const platformDir = getPlatformDirectory(platform5);
|
|
50403
|
-
const configPath = (0,
|
|
50404
|
-
if (!(0,
|
|
50405
|
-
(0,
|
|
50502
|
+
const configPath = (0, import_path23.join)(directory, platformDir);
|
|
50503
|
+
if (!(0, import_fs24.existsSync)(configPath)) {
|
|
50504
|
+
(0, import_fs24.mkdirSync)(configPath, { recursive: true });
|
|
50406
50505
|
}
|
|
50407
50506
|
try {
|
|
50408
50507
|
const parsedContent = JSON.parse(configData.configContent);
|
|
50409
50508
|
for (const [filePath, content] of Object.entries(parsedContent)) {
|
|
50410
|
-
const fullPath = (0,
|
|
50411
|
-
const dir = (0,
|
|
50412
|
-
if (!(0,
|
|
50413
|
-
(0,
|
|
50509
|
+
const fullPath = (0, import_path23.join)(configPath, filePath);
|
|
50510
|
+
const dir = (0, import_path23.dirname)(fullPath);
|
|
50511
|
+
if (!(0, import_fs24.existsSync)(dir)) {
|
|
50512
|
+
(0, import_fs24.mkdirSync)(dir, { recursive: true });
|
|
50414
50513
|
}
|
|
50415
|
-
(0,
|
|
50416
|
-
platformFiles.push((0,
|
|
50514
|
+
(0, import_fs24.writeFileSync)(fullPath, content);
|
|
50515
|
+
platformFiles.push((0, import_path23.join)(platformDir, filePath));
|
|
50417
50516
|
platformItems.push({
|
|
50418
50517
|
path: filePath,
|
|
50419
50518
|
type: getItemType(filePath),
|
|
@@ -50422,9 +50521,9 @@ async function pullApprovedConfig(configRepo, authRepo, orgName, directory, plat
|
|
|
50422
50521
|
});
|
|
50423
50522
|
}
|
|
50424
50523
|
} catch {
|
|
50425
|
-
const singlePath = (0,
|
|
50426
|
-
(0,
|
|
50427
|
-
platformFiles.push((0,
|
|
50524
|
+
const singlePath = (0, import_path23.join)(configPath, "approved-config.json");
|
|
50525
|
+
(0, import_fs24.writeFileSync)(singlePath, configData.configContent);
|
|
50526
|
+
platformFiles.push((0, import_path23.join)(platformDir, "approved-config.json"));
|
|
50428
50527
|
}
|
|
50429
50528
|
}
|
|
50430
50529
|
}
|
|
@@ -50581,16 +50680,16 @@ async function pullApprovedConfig(configRepo, authRepo, orgName, directory, plat
|
|
|
50581
50680
|
}
|
|
50582
50681
|
} catch {
|
|
50583
50682
|
}
|
|
50584
|
-
const existingAgentsMdPath = (0,
|
|
50683
|
+
const existingAgentsMdPath = (0, import_path23.join)(directory, "AGENTS.md");
|
|
50585
50684
|
let existingDocsIndex;
|
|
50586
|
-
if ((0,
|
|
50587
|
-
const existingContent = (0,
|
|
50685
|
+
if ((0, import_fs24.existsSync)(existingAgentsMdPath)) {
|
|
50686
|
+
const existingContent = (0, import_fs24.readFileSync)(existingAgentsMdPath, "utf-8");
|
|
50588
50687
|
const dispatchMarker = "|@section:background-dispatch";
|
|
50589
50688
|
const markerIndex = existingContent.indexOf(dispatchMarker);
|
|
50590
50689
|
existingDocsIndex = markerIndex >= 0 ? existingContent.substring(0, markerIndex).trim() : existingContent.trim();
|
|
50591
50690
|
}
|
|
50592
50691
|
const agentsMdContent = generateAgentsMd(existingDocsIndex, dispatchRules);
|
|
50593
|
-
(0,
|
|
50692
|
+
(0, import_fs24.writeFileSync)(existingAgentsMdPath, agentsMdContent, "utf-8");
|
|
50594
50693
|
allSyncedFiles.push("AGENTS.md");
|
|
50595
50694
|
allSyncedItems.push({
|
|
50596
50695
|
path: "AGENTS.md",
|
|
@@ -50604,11 +50703,11 @@ async function pullApprovedConfig(configRepo, authRepo, orgName, directory, plat
|
|
|
50604
50703
|
console.log(source_default.dim(` Written: AGENTS.md (universal cross-platform)`));
|
|
50605
50704
|
}
|
|
50606
50705
|
if (dispatchRules) {
|
|
50607
|
-
const galDir = (0,
|
|
50608
|
-
if (!(0,
|
|
50609
|
-
(0,
|
|
50706
|
+
const galDir = (0, import_path23.join)(directory, ".gal");
|
|
50707
|
+
if (!(0, import_fs24.existsSync)(galDir)) {
|
|
50708
|
+
(0, import_fs24.mkdirSync)(galDir, { recursive: true });
|
|
50610
50709
|
}
|
|
50611
|
-
(0,
|
|
50710
|
+
(0, import_fs24.writeFileSync)((0, import_path23.join)(galDir, "dispatch-rules.json"), JSON.stringify(dispatchRules), "utf-8");
|
|
50612
50711
|
if (isFullOutput) {
|
|
50613
50712
|
console.log(source_default.dim(` Written: .gal/dispatch-rules.json (hook cache)`));
|
|
50614
50713
|
}
|
|
@@ -50811,12 +50910,12 @@ async function pullPersonalRepoConfig(authRepo, repoName, directory) {
|
|
|
50811
50910
|
const syncedItems = [];
|
|
50812
50911
|
for (const config2 of configs) {
|
|
50813
50912
|
const relativePath = config2.path.replace(/^\/+/, "");
|
|
50814
|
-
const fullPath = (0,
|
|
50815
|
-
const dir = (0,
|
|
50816
|
-
if (!(0,
|
|
50817
|
-
(0,
|
|
50913
|
+
const fullPath = (0, import_path23.join)(directory, relativePath);
|
|
50914
|
+
const dir = (0, import_path23.dirname)(fullPath);
|
|
50915
|
+
if (!(0, import_fs24.existsSync)(dir)) {
|
|
50916
|
+
(0, import_fs24.mkdirSync)(dir, { recursive: true });
|
|
50818
50917
|
}
|
|
50819
|
-
(0,
|
|
50918
|
+
(0, import_fs24.writeFileSync)(fullPath, config2.content);
|
|
50820
50919
|
syncedFiles.push(relativePath);
|
|
50821
50920
|
const itemType = getItemType(relativePath);
|
|
50822
50921
|
const itemName = getItemName(relativePath);
|
|
@@ -50866,20 +50965,20 @@ async function pullPersonalApprovedConfig(authRepo, approvedConfig, directory) {
|
|
|
50866
50965
|
}
|
|
50867
50966
|
const configData = JSON.parse(approvedConfig.configContent);
|
|
50868
50967
|
const platformDir = ".claude";
|
|
50869
|
-
const configPath = (0,
|
|
50870
|
-
if (!(0,
|
|
50871
|
-
(0,
|
|
50968
|
+
const configPath = (0, import_path23.join)(directory, platformDir);
|
|
50969
|
+
if (!(0, import_fs24.existsSync)(configPath)) {
|
|
50970
|
+
(0, import_fs24.mkdirSync)(configPath, { recursive: true });
|
|
50872
50971
|
}
|
|
50873
50972
|
const syncedFiles = [];
|
|
50874
50973
|
const syncedItems = [];
|
|
50875
50974
|
for (const [filePath, content] of Object.entries(configData)) {
|
|
50876
|
-
const fullPath = (0,
|
|
50877
|
-
const dir = (0,
|
|
50878
|
-
if (!(0,
|
|
50879
|
-
(0,
|
|
50975
|
+
const fullPath = (0, import_path23.join)(configPath, filePath);
|
|
50976
|
+
const dir = (0, import_path23.dirname)(fullPath);
|
|
50977
|
+
if (!(0, import_fs24.existsSync)(dir)) {
|
|
50978
|
+
(0, import_fs24.mkdirSync)(dir, { recursive: true });
|
|
50880
50979
|
}
|
|
50881
|
-
(0,
|
|
50882
|
-
const relativePath = (0,
|
|
50980
|
+
(0, import_fs24.writeFileSync)(fullPath, content);
|
|
50981
|
+
const relativePath = (0, import_path23.join)(platformDir, filePath);
|
|
50883
50982
|
syncedFiles.push(relativePath);
|
|
50884
50983
|
const itemType = getItemType(filePath);
|
|
50885
50984
|
const itemName = getItemName(filePath);
|
|
@@ -50939,18 +51038,18 @@ async function checkApprovedConfig(configRepo, orgName, directory, platformFilte
|
|
|
50939
51038
|
const platformDir = getPlatformDirectory(platform5);
|
|
50940
51039
|
if (approvedConfig.instructions?.content) {
|
|
50941
51040
|
const relativePath = "CLAUDE.md";
|
|
50942
|
-
const fullPath = (0,
|
|
51041
|
+
const fullPath = (0, import_path23.join)(directory, relativePath);
|
|
50943
51042
|
result.expectedFiles.push(relativePath);
|
|
50944
|
-
if (!(0,
|
|
51043
|
+
if (!(0, import_fs24.existsSync)(fullPath)) {
|
|
50945
51044
|
result.missingFiles.push(relativePath);
|
|
50946
51045
|
result.inSync = false;
|
|
50947
51046
|
}
|
|
50948
51047
|
}
|
|
50949
51048
|
if (approvedConfig.settings?.content) {
|
|
50950
|
-
const relativePath = (0,
|
|
50951
|
-
const fullPath = (0,
|
|
51049
|
+
const relativePath = (0, import_path23.join)(platformDir, "settings.json");
|
|
51050
|
+
const fullPath = (0, import_path23.join)(directory, relativePath);
|
|
50952
51051
|
result.expectedFiles.push(relativePath);
|
|
50953
|
-
if (!(0,
|
|
51052
|
+
if (!(0, import_fs24.existsSync)(fullPath)) {
|
|
50954
51053
|
result.missingFiles.push(relativePath);
|
|
50955
51054
|
result.inSync = false;
|
|
50956
51055
|
}
|
|
@@ -50959,10 +51058,10 @@ async function checkApprovedConfig(configRepo, orgName, directory, platformFilte
|
|
|
50959
51058
|
for (const cmd of approvedConfig.commands) {
|
|
50960
51059
|
const pathFromName = cmd.name.replace(/:/g, "/");
|
|
50961
51060
|
const fileName = pathFromName.endsWith(".md") ? pathFromName : `${pathFromName}.md`;
|
|
50962
|
-
const relativePath = (0,
|
|
50963
|
-
const fullPath = (0,
|
|
51061
|
+
const relativePath = (0, import_path23.join)(platformDir, "commands", fileName);
|
|
51062
|
+
const fullPath = (0, import_path23.join)(directory, relativePath);
|
|
50964
51063
|
result.expectedFiles.push(relativePath);
|
|
50965
|
-
if (!(0,
|
|
51064
|
+
if (!(0, import_fs24.existsSync)(fullPath)) {
|
|
50966
51065
|
result.missingFiles.push(relativePath);
|
|
50967
51066
|
result.inSync = false;
|
|
50968
51067
|
}
|
|
@@ -50971,10 +51070,10 @@ async function checkApprovedConfig(configRepo, orgName, directory, platformFilte
|
|
|
50971
51070
|
if (approvedConfig.rules && approvedConfig.rules.length > 0) {
|
|
50972
51071
|
for (const rule of approvedConfig.rules) {
|
|
50973
51072
|
const fileName = rule.name.endsWith(".md") ? rule.name : `${rule.name}.md`;
|
|
50974
|
-
const relativePath = (0,
|
|
50975
|
-
const fullPath = (0,
|
|
51073
|
+
const relativePath = (0, import_path23.join)(platformDir, "rules", fileName);
|
|
51074
|
+
const fullPath = (0, import_path23.join)(directory, relativePath);
|
|
50976
51075
|
result.expectedFiles.push(relativePath);
|
|
50977
|
-
if (!(0,
|
|
51076
|
+
if (!(0, import_fs24.existsSync)(fullPath)) {
|
|
50978
51077
|
result.missingFiles.push(relativePath);
|
|
50979
51078
|
result.inSync = false;
|
|
50980
51079
|
}
|
|
@@ -50985,7 +51084,7 @@ async function checkApprovedConfig(configRepo, orgName, directory, platformFilte
|
|
|
50985
51084
|
}
|
|
50986
51085
|
console.log(JSON.stringify(result));
|
|
50987
51086
|
}
|
|
50988
|
-
var
|
|
51087
|
+
var import_fs24, import_path23, import_os18, import_crypto6, cliVersion4, defaultApiUrl4, GAL_CLI_CURSOR_RULES_VERSION, GAL_CLI_CURSOR_RULES, CODEX_PROMPT_PREFIX, GEMINI_COMMANDS_DIR, GEMINI_SKILLS_DIR;
|
|
50989
51088
|
var init_sync = __esm({
|
|
50990
51089
|
"src/commands/sync.ts"() {
|
|
50991
51090
|
"use strict";
|
|
@@ -50995,9 +51094,9 @@ var init_sync = __esm({
|
|
|
50995
51094
|
init_constants();
|
|
50996
51095
|
init_config_manager();
|
|
50997
51096
|
init_telemetry();
|
|
50998
|
-
|
|
50999
|
-
|
|
51000
|
-
|
|
51097
|
+
import_fs24 = require("fs");
|
|
51098
|
+
import_path23 = require("path");
|
|
51099
|
+
import_os18 = require("os");
|
|
51001
51100
|
init_project_detection();
|
|
51002
51101
|
import_crypto6 = require("crypto");
|
|
51003
51102
|
init_dist2();
|
|
@@ -51009,6 +51108,7 @@ var init_sync = __esm({
|
|
|
51009
51108
|
init_dispatch_categories();
|
|
51010
51109
|
init_mcp_config_writer();
|
|
51011
51110
|
init_browser_profile_sync();
|
|
51111
|
+
init_sync_initialization();
|
|
51012
51112
|
cliVersion4 = constants_default[0];
|
|
51013
51113
|
defaultApiUrl4 = constants_default[1];
|
|
51014
51114
|
GAL_CLI_CURSOR_RULES_VERSION = "1.0.0";
|
|
@@ -51193,7 +51293,7 @@ function reportPostLoginSetup(result, username, org) {
|
|
|
51193
51293
|
}
|
|
51194
51294
|
}
|
|
51195
51295
|
function startCallbackServer(timeout = 12e4) {
|
|
51196
|
-
return new Promise((
|
|
51296
|
+
return new Promise((resolve11, reject) => {
|
|
51197
51297
|
const server = (0, import_http.createServer)((req, res) => {
|
|
51198
51298
|
const url = new URL(req.url || "", `http://localhost:${CLI_CALLBACK_PORT}`);
|
|
51199
51299
|
if (url.pathname === CLI_CALLBACK_PATH) {
|
|
@@ -51234,7 +51334,7 @@ function startCallbackServer(timeout = 12e4) {
|
|
|
51234
51334
|
} catch {
|
|
51235
51335
|
}
|
|
51236
51336
|
}
|
|
51237
|
-
|
|
51337
|
+
resolve11({ token, user });
|
|
51238
51338
|
return;
|
|
51239
51339
|
}
|
|
51240
51340
|
res.writeHead(400, { "Content-Type": "text/plain" });
|
|
@@ -51573,7 +51673,7 @@ Review status: ${source_default.cyan("gal auth status")}
|
|
|
51573
51673
|
let accessToken;
|
|
51574
51674
|
let refreshToken;
|
|
51575
51675
|
let expiresAt;
|
|
51576
|
-
const claudeDir = (0,
|
|
51676
|
+
const claudeDir = (0, import_path24.join)((0, import_os19.homedir)(), ".claude");
|
|
51577
51677
|
let credentialSource2 = "";
|
|
51578
51678
|
const isSetupTokenMode2 = !!options.setupToken;
|
|
51579
51679
|
if (options.setupToken) {
|
|
@@ -51654,13 +51754,13 @@ Review status: ${source_default.cyan("gal auth status")}
|
|
|
51654
51754
|
}
|
|
51655
51755
|
}
|
|
51656
51756
|
if (!isSetupTokenMode2 && (!accessToken || !refreshToken)) {
|
|
51657
|
-
const legacyCredentialsPath = (0,
|
|
51757
|
+
const legacyCredentialsPath = (0, import_path24.join)(claudeDir, ".credentials.json");
|
|
51658
51758
|
if (verbose) {
|
|
51659
51759
|
spinner.info(source_default.dim(` Trying ${legacyCredentialsPath}...`));
|
|
51660
51760
|
}
|
|
51661
|
-
if ((0,
|
|
51761
|
+
if ((0, import_fs25.existsSync)(legacyCredentialsPath)) {
|
|
51662
51762
|
try {
|
|
51663
|
-
const content = (0,
|
|
51763
|
+
const content = (0, import_fs25.readFileSync)(legacyCredentialsPath, "utf-8");
|
|
51664
51764
|
const credentials = JSON.parse(content);
|
|
51665
51765
|
accessToken = credentials.claudeAiOauth?.accessToken;
|
|
51666
51766
|
refreshToken = credentials.claudeAiOauth?.refreshToken;
|
|
@@ -51684,13 +51784,13 @@ Review status: ${source_default.cyan("gal auth status")}
|
|
|
51684
51784
|
}
|
|
51685
51785
|
}
|
|
51686
51786
|
if (!isSetupTokenMode2 && (!accessToken || !refreshToken)) {
|
|
51687
|
-
const configPath = (0,
|
|
51787
|
+
const configPath = (0, import_path24.join)(claudeDir, ".claude.json");
|
|
51688
51788
|
if (verbose) {
|
|
51689
51789
|
spinner.info(source_default.dim(` Trying ${configPath} (oauthCredentials field)...`));
|
|
51690
51790
|
}
|
|
51691
|
-
if ((0,
|
|
51791
|
+
if ((0, import_fs25.existsSync)(configPath)) {
|
|
51692
51792
|
try {
|
|
51693
|
-
const content = (0,
|
|
51793
|
+
const content = (0, import_fs25.readFileSync)(configPath, "utf-8");
|
|
51694
51794
|
const claudeConfig = JSON.parse(content);
|
|
51695
51795
|
accessToken = claudeConfig.oauthCredentials?.claudeAiOauth?.accessToken;
|
|
51696
51796
|
refreshToken = claudeConfig.oauthCredentials?.claudeAiOauth?.refreshToken;
|
|
@@ -51813,13 +51913,13 @@ Review status: ${source_default.cyan("gal auth status")}
|
|
|
51813
51913
|
spinner.info(source_default.dim(" Using API key from command line"));
|
|
51814
51914
|
}
|
|
51815
51915
|
} else {
|
|
51816
|
-
const codexAuthPath = (0,
|
|
51916
|
+
const codexAuthPath = (0, import_path24.join)((0, import_os19.homedir)(), ".codex", "auth.json");
|
|
51817
51917
|
if (verbose) {
|
|
51818
51918
|
spinner.info(source_default.dim(` Trying ${codexAuthPath}...`));
|
|
51819
51919
|
}
|
|
51820
|
-
if ((0,
|
|
51920
|
+
if ((0, import_fs25.existsSync)(codexAuthPath)) {
|
|
51821
51921
|
try {
|
|
51822
|
-
const content = (0,
|
|
51922
|
+
const content = (0, import_fs25.readFileSync)(codexAuthPath, "utf-8");
|
|
51823
51923
|
const authData = JSON.parse(content);
|
|
51824
51924
|
if (verbose) {
|
|
51825
51925
|
spinner.info(source_default.dim(` Found auth.json, checking tokens...`));
|
|
@@ -51931,13 +52031,13 @@ Source: ${credentialSource2}`));
|
|
|
51931
52031
|
spinner.info(source_default.dim(" Using API key from command line"));
|
|
51932
52032
|
}
|
|
51933
52033
|
} else {
|
|
51934
|
-
const geminiAuthPath = (0,
|
|
52034
|
+
const geminiAuthPath = (0, import_path24.join)((0, import_os19.homedir)(), ".gemini", "oauth_creds.json");
|
|
51935
52035
|
if (verbose) {
|
|
51936
52036
|
spinner.info(source_default.dim(` Trying ${geminiAuthPath}...`));
|
|
51937
52037
|
}
|
|
51938
|
-
if ((0,
|
|
52038
|
+
if ((0, import_fs25.existsSync)(geminiAuthPath)) {
|
|
51939
52039
|
try {
|
|
51940
|
-
const content = (0,
|
|
52040
|
+
const content = (0, import_fs25.readFileSync)(geminiAuthPath, "utf-8");
|
|
51941
52041
|
const authData = JSON.parse(content);
|
|
51942
52042
|
if (verbose) {
|
|
51943
52043
|
spinner.info(source_default.dim(` Found oauth_creds.json, checking tokens...`));
|
|
@@ -52042,13 +52142,13 @@ Source: ${credentialSource2}`));
|
|
|
52042
52142
|
spinner.info(source_default.dim(" Using access token from command line"));
|
|
52043
52143
|
}
|
|
52044
52144
|
} else {
|
|
52045
|
-
const cursorAuthPath = (0,
|
|
52145
|
+
const cursorAuthPath = (0, import_path24.join)((0, import_os19.homedir)(), ".cursor", "auth.json");
|
|
52046
52146
|
if (verbose) {
|
|
52047
52147
|
spinner.info(source_default.dim(` Trying ${cursorAuthPath}...`));
|
|
52048
52148
|
}
|
|
52049
|
-
if ((0,
|
|
52149
|
+
if ((0, import_fs25.existsSync)(cursorAuthPath)) {
|
|
52050
52150
|
try {
|
|
52051
|
-
const content = (0,
|
|
52151
|
+
const content = (0, import_fs25.readFileSync)(cursorAuthPath, "utf-8");
|
|
52052
52152
|
const authData = JSON.parse(content);
|
|
52053
52153
|
if (verbose) {
|
|
52054
52154
|
spinner.info(source_default.dim(` Found auth.json, checking tokens...`));
|
|
@@ -52128,10 +52228,10 @@ Source: ${credentialSource2}`));
|
|
|
52128
52228
|
const apiUrl = config2.apiUrl || defaultApiUrl5;
|
|
52129
52229
|
function prompt2(question) {
|
|
52130
52230
|
const rl = (0, import_readline2.createInterface)({ input: process.stdin, output: process.stdout });
|
|
52131
|
-
return new Promise((
|
|
52231
|
+
return new Promise((resolve11) => {
|
|
52132
52232
|
rl.question(question, (answer) => {
|
|
52133
52233
|
rl.close();
|
|
52134
|
-
|
|
52234
|
+
resolve11(answer.trim());
|
|
52135
52235
|
});
|
|
52136
52236
|
});
|
|
52137
52237
|
}
|
|
@@ -52358,7 +52458,7 @@ Source: ${credentialSource2}`));
|
|
|
52358
52458
|
});
|
|
52359
52459
|
return auth;
|
|
52360
52460
|
}
|
|
52361
|
-
var import_http, import_child_process7,
|
|
52461
|
+
var import_http, import_child_process7, import_os19, import_fs25, import_path24, import_readline2, CLI_CALLBACK_PORT, CLI_CALLBACK_PATH, cliVersion5, defaultApiUrl5;
|
|
52362
52462
|
var init_auth2 = __esm({
|
|
52363
52463
|
"src/commands/auth.ts"() {
|
|
52364
52464
|
"use strict";
|
|
@@ -52371,9 +52471,9 @@ var init_auth2 = __esm({
|
|
|
52371
52471
|
init_constants();
|
|
52372
52472
|
init_CoreServiceProvider();
|
|
52373
52473
|
init_telemetry();
|
|
52374
|
-
|
|
52375
|
-
|
|
52376
|
-
|
|
52474
|
+
import_os19 = require("os");
|
|
52475
|
+
import_fs25 = require("fs");
|
|
52476
|
+
import_path24 = require("path");
|
|
52377
52477
|
init_hooks();
|
|
52378
52478
|
init_sync();
|
|
52379
52479
|
import_readline2 = require("readline");
|
|
@@ -52388,13 +52488,13 @@ var init_auth2 = __esm({
|
|
|
52388
52488
|
// src/commands/check.ts
|
|
52389
52489
|
function createCheckCommand() {
|
|
52390
52490
|
const command = new Command("check").description("Pre-enforcement check - see what issues will block your commit").option("--fix", "Auto-fix issues where possible").option("--interactive", "Interactive mode to review issues").option("--report", "Generate detailed JSON report").option("--path <path>", "Project path to check", process.cwd()).action(async (options) => {
|
|
52391
|
-
if (!(0,
|
|
52491
|
+
if (!(0, import_fs26.existsSync)(options.path)) {
|
|
52392
52492
|
console.error(source_default.red(`
|
|
52393
52493
|
Error: Path does not exist: ${options.path}
|
|
52394
52494
|
`));
|
|
52395
52495
|
process.exit(1);
|
|
52396
52496
|
}
|
|
52397
|
-
if (!(0,
|
|
52497
|
+
if (!(0, import_fs26.statSync)(options.path).isDirectory()) {
|
|
52398
52498
|
console.error(source_default.red(`
|
|
52399
52499
|
Error: Path is not a directory: ${options.path}
|
|
52400
52500
|
`));
|
|
@@ -52406,8 +52506,8 @@ Error: Path is not a directory: ${options.path}
|
|
|
52406
52506
|
});
|
|
52407
52507
|
const report = await checker.runAllChecks();
|
|
52408
52508
|
if (options.report) {
|
|
52409
|
-
const reportPath = (0,
|
|
52410
|
-
(0,
|
|
52509
|
+
const reportPath = (0, import_path25.join)(options.path, "gal-check-report.json");
|
|
52510
|
+
(0, import_fs26.writeFileSync)(reportPath, JSON.stringify(report, null, 2));
|
|
52411
52511
|
console.log(source_default.blue(`Report saved to: ${reportPath}`));
|
|
52412
52512
|
}
|
|
52413
52513
|
if (report.summary.blocked) {
|
|
@@ -52416,14 +52516,14 @@ Error: Path is not a directory: ${options.path}
|
|
|
52416
52516
|
});
|
|
52417
52517
|
return command;
|
|
52418
52518
|
}
|
|
52419
|
-
var
|
|
52519
|
+
var import_fs26, import_path25, import_child_process8, SECRET_PATTERNS, DANGEROUS_PATTERNS, FORBIDDEN_FILES, PreEnforcementChecker;
|
|
52420
52520
|
var init_check = __esm({
|
|
52421
52521
|
"src/commands/check.ts"() {
|
|
52422
52522
|
"use strict";
|
|
52423
52523
|
init_esm();
|
|
52424
52524
|
init_source();
|
|
52425
|
-
|
|
52426
|
-
|
|
52525
|
+
import_fs26 = require("fs");
|
|
52526
|
+
import_path25 = require("path");
|
|
52427
52527
|
import_child_process8 = require("child_process");
|
|
52428
52528
|
SECRET_PATTERNS = [
|
|
52429
52529
|
{
|
|
@@ -52575,10 +52675,10 @@ var init_check = __esm({
|
|
|
52575
52675
|
const scan = (currentDir, depth) => {
|
|
52576
52676
|
if (depth > maxDepth) return;
|
|
52577
52677
|
try {
|
|
52578
|
-
const entries = (0,
|
|
52678
|
+
const entries = (0, import_fs26.readdirSync)(currentDir, { withFileTypes: true });
|
|
52579
52679
|
for (const entry of entries) {
|
|
52580
|
-
const fullPath = (0,
|
|
52581
|
-
const relativePath = (0,
|
|
52680
|
+
const fullPath = (0, import_path25.join)(currentDir, entry.name);
|
|
52681
|
+
const relativePath = (0, import_path25.relative)(this.projectPath, fullPath);
|
|
52582
52682
|
if (entry.isDirectory()) {
|
|
52583
52683
|
if (!ignoreDirs.includes(entry.name)) {
|
|
52584
52684
|
scan(fullPath, depth + 1);
|
|
@@ -52598,10 +52698,10 @@ var init_check = __esm({
|
|
|
52598
52698
|
*/
|
|
52599
52699
|
async checkForSecrets(files) {
|
|
52600
52700
|
for (const file of files) {
|
|
52601
|
-
const fullPath = (0,
|
|
52602
|
-
if (!(0,
|
|
52701
|
+
const fullPath = (0, import_path25.join)(this.projectPath, file);
|
|
52702
|
+
if (!(0, import_fs26.existsSync)(fullPath) || !this.isTextFile(fullPath)) continue;
|
|
52603
52703
|
try {
|
|
52604
|
-
const content = (0,
|
|
52704
|
+
const content = (0, import_fs26.readFileSync)(fullPath, "utf-8");
|
|
52605
52705
|
const lines = content.split("\n");
|
|
52606
52706
|
for (const { name, pattern, severity, suggestion } of SECRET_PATTERNS) {
|
|
52607
52707
|
pattern.lastIndex = 0;
|
|
@@ -52633,13 +52733,13 @@ var init_check = __esm({
|
|
|
52633
52733
|
async checkForDangerousCommands(files) {
|
|
52634
52734
|
const scriptExtensions = [".sh", ".bash", ".zsh", ".ps1", ".bat", ".cmd"];
|
|
52635
52735
|
for (const file of files) {
|
|
52636
|
-
const fullPath = (0,
|
|
52637
|
-
if (!(0,
|
|
52736
|
+
const fullPath = (0, import_path25.join)(this.projectPath, file);
|
|
52737
|
+
if (!(0, import_fs26.existsSync)(fullPath)) continue;
|
|
52638
52738
|
const isScript = scriptExtensions.some((ext) => file.endsWith(ext));
|
|
52639
52739
|
const isConfig = file.includes("hook") || file.includes("command");
|
|
52640
52740
|
if (!isScript && !isConfig) continue;
|
|
52641
52741
|
try {
|
|
52642
|
-
const content = (0,
|
|
52742
|
+
const content = (0, import_fs26.readFileSync)(fullPath, "utf-8");
|
|
52643
52743
|
for (const { name, pattern, severity, suggestion } of DANGEROUS_PATTERNS) {
|
|
52644
52744
|
pattern.lastIndex = 0;
|
|
52645
52745
|
let match;
|
|
@@ -52692,14 +52792,14 @@ var init_check = __esm({
|
|
|
52692
52792
|
async checkAgentConfigs() {
|
|
52693
52793
|
const configDirs = [".claude", ".cursor", ".gemini", ".codex", ".windsurf"];
|
|
52694
52794
|
for (const dir of configDirs) {
|
|
52695
|
-
const dirPath = (0,
|
|
52696
|
-
if (!(0,
|
|
52795
|
+
const dirPath = (0, import_path25.join)(this.projectPath, dir);
|
|
52796
|
+
if (!(0, import_fs26.existsSync)(dirPath)) continue;
|
|
52697
52797
|
const files = this.scanDirectory(dirPath, 2);
|
|
52698
52798
|
for (const file of files) {
|
|
52699
|
-
const fullPath = (0,
|
|
52700
|
-
if (!(0,
|
|
52799
|
+
const fullPath = (0, import_path25.join)(this.projectPath, file);
|
|
52800
|
+
if (!(0, import_fs26.existsSync)(fullPath)) continue;
|
|
52701
52801
|
try {
|
|
52702
|
-
const content = (0,
|
|
52802
|
+
const content = (0, import_fs26.readFileSync)(fullPath, "utf-8");
|
|
52703
52803
|
if (content.includes('"allowAll": true') || content.includes("allowAll: true")) {
|
|
52704
52804
|
this.issues.push({
|
|
52705
52805
|
severity: "high",
|
|
@@ -52739,7 +52839,7 @@ var init_check = __esm({
|
|
|
52739
52839
|
file.replace("src/", "src/__tests__/").replace(/\.(ts|tsx|js|jsx)$/, ".test.$1")
|
|
52740
52840
|
];
|
|
52741
52841
|
const hasTest = testVariants.some(
|
|
52742
|
-
(testFile) => (0,
|
|
52842
|
+
(testFile) => (0, import_fs26.existsSync)((0, import_path25.join)(this.projectPath, testFile))
|
|
52743
52843
|
);
|
|
52744
52844
|
if (!hasTest) {
|
|
52745
52845
|
this.issues.push({
|
|
@@ -56185,7 +56285,7 @@ var init_config = __esm({
|
|
|
56185
56285
|
|
|
56186
56286
|
// src/commands/discover.ts
|
|
56187
56287
|
function sleep(ms) {
|
|
56188
|
-
return new Promise((
|
|
56288
|
+
return new Promise((resolve11) => setTimeout(resolve11, ms));
|
|
56189
56289
|
}
|
|
56190
56290
|
function getTimeAgo(date3) {
|
|
56191
56291
|
const diff = Date.now() - date3.getTime();
|
|
@@ -58488,10 +58588,10 @@ function isFeedbackDisabled() {
|
|
|
58488
58588
|
}
|
|
58489
58589
|
function prompt(question) {
|
|
58490
58590
|
const rl = (0, import_readline3.createInterface)({ input: process.stdin, output: process.stdout });
|
|
58491
|
-
return new Promise((
|
|
58591
|
+
return new Promise((resolve11) => {
|
|
58492
58592
|
rl.question(question, (answer) => {
|
|
58493
58593
|
rl.close();
|
|
58494
|
-
|
|
58594
|
+
resolve11(answer.trim());
|
|
58495
58595
|
});
|
|
58496
58596
|
});
|
|
58497
58597
|
}
|
|
@@ -58723,18 +58823,18 @@ Writing configs to ${outputDir}:
|
|
|
58723
58823
|
if (!fileName.includes(".")) {
|
|
58724
58824
|
fileName = `${fileName}${extension}`;
|
|
58725
58825
|
}
|
|
58726
|
-
const relativePath = categoryDir ? (0,
|
|
58727
|
-
const fullPath = (0,
|
|
58826
|
+
const relativePath = categoryDir ? (0, import_path26.join)(platformDir, categoryDir, fileName) : (0, import_path26.join)(platformDir, fileName);
|
|
58827
|
+
const fullPath = (0, import_path26.join)(outputDir, relativePath);
|
|
58728
58828
|
if (options.dryRun) {
|
|
58729
58829
|
console.log(source_default.cyan(" [dry-run]"), relativePath);
|
|
58730
58830
|
writtenFiles.push(relativePath);
|
|
58731
58831
|
continue;
|
|
58732
58832
|
}
|
|
58733
|
-
const dir = (0,
|
|
58734
|
-
if (!(0,
|
|
58735
|
-
(0,
|
|
58833
|
+
const dir = (0, import_path26.dirname)(fullPath);
|
|
58834
|
+
if (!(0, import_fs27.existsSync)(dir)) {
|
|
58835
|
+
(0, import_fs27.mkdirSync)(dir, { recursive: true });
|
|
58736
58836
|
}
|
|
58737
|
-
(0,
|
|
58837
|
+
(0, import_fs27.writeFileSync)(fullPath, file.content, "utf-8");
|
|
58738
58838
|
writtenFiles.push(relativePath);
|
|
58739
58839
|
console.log(source_default.green(" \u2713"), relativePath);
|
|
58740
58840
|
}
|
|
@@ -58795,7 +58895,7 @@ Files written to ${outputDir}`));
|
|
|
58795
58895
|
});
|
|
58796
58896
|
return command;
|
|
58797
58897
|
}
|
|
58798
|
-
var
|
|
58898
|
+
var import_fs27, import_path26, PLATFORM_DIRS4, CATEGORY_DIRS, FILE_EXTENSIONS;
|
|
58799
58899
|
var init_fetch = __esm({
|
|
58800
58900
|
"src/commands/fetch.ts"() {
|
|
58801
58901
|
"use strict";
|
|
@@ -58804,8 +58904,8 @@ var init_fetch = __esm({
|
|
|
58804
58904
|
init_ora();
|
|
58805
58905
|
init_config_manager();
|
|
58806
58906
|
init_CoreServiceProvider();
|
|
58807
|
-
|
|
58808
|
-
|
|
58907
|
+
import_fs27 = require("fs");
|
|
58908
|
+
import_path26 = require("path");
|
|
58809
58909
|
init_capability_checker();
|
|
58810
58910
|
init_dist2();
|
|
58811
58911
|
PLATFORM_DIRS4 = { ...PLATFORM_DIRECTORY_MAP };
|
|
@@ -59067,13 +59167,13 @@ function getGitEmail() {
|
|
|
59067
59167
|
}
|
|
59068
59168
|
async function getLocalEnforcementStatus() {
|
|
59069
59169
|
const { stat: stat5, readFile: readFile4 } = await import("node:fs/promises");
|
|
59070
|
-
const { join:
|
|
59170
|
+
const { join: join51 } = await import("node:path");
|
|
59071
59171
|
const platforms = [];
|
|
59072
59172
|
let version2 = "0.0.0";
|
|
59073
59173
|
let policyVersion = "0.0.0";
|
|
59074
59174
|
const platformDirs = [".claude", ".cursor", ".gemini", ".codex", ".windsurf"];
|
|
59075
59175
|
for (const dir of platformDirs) {
|
|
59076
|
-
const hookPath =
|
|
59176
|
+
const hookPath = join51(process.cwd(), dir, "hooks", "gal-safety-hook.py");
|
|
59077
59177
|
try {
|
|
59078
59178
|
await stat5(hookPath);
|
|
59079
59179
|
platforms.push(dir.replace(".", ""));
|
|
@@ -59086,7 +59186,7 @@ async function getLocalEnforcementStatus() {
|
|
|
59086
59186
|
}
|
|
59087
59187
|
}
|
|
59088
59188
|
try {
|
|
59089
|
-
const pkgPath =
|
|
59189
|
+
const pkgPath = join51(import_meta2.url.replace("file://", ""), "..", "..", "..", "package.json");
|
|
59090
59190
|
const pkg = JSON.parse(await readFile4(pkgPath, "utf-8"));
|
|
59091
59191
|
version2 = pkg.version || "0.1.0";
|
|
59092
59192
|
} catch {
|
|
@@ -59546,15 +59646,15 @@ Task not running: ${taskId}
|
|
|
59546
59646
|
});
|
|
59547
59647
|
return command;
|
|
59548
59648
|
}
|
|
59549
|
-
var import_child_process9,
|
|
59649
|
+
var import_child_process9, import_fs28, import_path27, DEFAULT_CONFIG, TASK_TEMPLATES, HeadlessRunner;
|
|
59550
59650
|
var init_headless = __esm({
|
|
59551
59651
|
"src/commands/headless.ts"() {
|
|
59552
59652
|
"use strict";
|
|
59553
59653
|
init_esm();
|
|
59554
59654
|
init_source();
|
|
59555
59655
|
import_child_process9 = require("child_process");
|
|
59556
|
-
|
|
59557
|
-
|
|
59656
|
+
import_fs28 = require("fs");
|
|
59657
|
+
import_path27 = require("path");
|
|
59558
59658
|
DEFAULT_CONFIG = {
|
|
59559
59659
|
dataDir: ".gal/headless",
|
|
59560
59660
|
logDir: ".gal/headless/logs",
|
|
@@ -59608,23 +59708,23 @@ var init_headless = __esm({
|
|
|
59608
59708
|
* Ensure required directories exist
|
|
59609
59709
|
*/
|
|
59610
59710
|
ensureDirectories() {
|
|
59611
|
-
const dataDir = (0,
|
|
59612
|
-
const logDir = (0,
|
|
59613
|
-
if (!(0,
|
|
59614
|
-
(0,
|
|
59711
|
+
const dataDir = (0, import_path27.join)(this.projectPath, this.config.dataDir);
|
|
59712
|
+
const logDir = (0, import_path27.join)(this.projectPath, this.config.logDir);
|
|
59713
|
+
if (!(0, import_fs28.existsSync)(dataDir)) {
|
|
59714
|
+
(0, import_fs28.mkdirSync)(dataDir, { recursive: true });
|
|
59615
59715
|
}
|
|
59616
|
-
if (!(0,
|
|
59617
|
-
(0,
|
|
59716
|
+
if (!(0, import_fs28.existsSync)(logDir)) {
|
|
59717
|
+
(0, import_fs28.mkdirSync)(logDir, { recursive: true });
|
|
59618
59718
|
}
|
|
59619
59719
|
}
|
|
59620
59720
|
/**
|
|
59621
59721
|
* Load tasks from disk
|
|
59622
59722
|
*/
|
|
59623
59723
|
loadTasks() {
|
|
59624
|
-
const tasksFile = (0,
|
|
59625
|
-
if ((0,
|
|
59724
|
+
const tasksFile = (0, import_path27.join)(this.projectPath, this.config.dataDir, "tasks.json");
|
|
59725
|
+
if ((0, import_fs28.existsSync)(tasksFile)) {
|
|
59626
59726
|
try {
|
|
59627
|
-
const data = JSON.parse((0,
|
|
59727
|
+
const data = JSON.parse((0, import_fs28.readFileSync)(tasksFile, "utf-8"));
|
|
59628
59728
|
for (const task of data.tasks || []) {
|
|
59629
59729
|
this.tasks.set(task.id, {
|
|
59630
59730
|
...task,
|
|
@@ -59641,12 +59741,12 @@ var init_headless = __esm({
|
|
|
59641
59741
|
* Save tasks to disk
|
|
59642
59742
|
*/
|
|
59643
59743
|
saveTasks() {
|
|
59644
|
-
const tasksFile = (0,
|
|
59744
|
+
const tasksFile = (0, import_path27.join)(this.projectPath, this.config.dataDir, "tasks.json");
|
|
59645
59745
|
const data = {
|
|
59646
59746
|
tasks: Array.from(this.tasks.values()),
|
|
59647
59747
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
59648
59748
|
};
|
|
59649
|
-
(0,
|
|
59749
|
+
(0, import_fs28.writeFileSync)(tasksFile, JSON.stringify(data, null, 2));
|
|
59650
59750
|
}
|
|
59651
59751
|
/**
|
|
59652
59752
|
* Create a new task
|
|
@@ -59697,7 +59797,7 @@ var init_headless = __esm({
|
|
|
59697
59797
|
task.status = "running";
|
|
59698
59798
|
task.startedAt = /* @__PURE__ */ new Date();
|
|
59699
59799
|
this.saveTasks();
|
|
59700
|
-
const logFile = (0,
|
|
59800
|
+
const logFile = (0, import_path27.join)(
|
|
59701
59801
|
this.projectPath,
|
|
59702
59802
|
this.config.logDir,
|
|
59703
59803
|
`${task.id}_${Date.now()}.log`
|
|
@@ -59709,7 +59809,7 @@ var init_headless = __esm({
|
|
|
59709
59809
|
console.log(source_default.gray(` Command: ${task.command}`));
|
|
59710
59810
|
console.log(source_default.gray(` Log file: ${logFile}
|
|
59711
59811
|
`));
|
|
59712
|
-
return new Promise((
|
|
59812
|
+
return new Promise((resolve11) => {
|
|
59713
59813
|
const child = (0, import_child_process9.spawn)("sh", ["-c", task.command], {
|
|
59714
59814
|
cwd: this.projectPath,
|
|
59715
59815
|
env: {
|
|
@@ -59723,7 +59823,7 @@ var init_headless = __esm({
|
|
|
59723
59823
|
const logStream = (data, isError = false) => {
|
|
59724
59824
|
const text = data.toString();
|
|
59725
59825
|
const prefix = isError ? "[ERROR] " : "";
|
|
59726
|
-
(0,
|
|
59826
|
+
(0, import_fs28.appendFileSync)(logFile, `${(/* @__PURE__ */ new Date()).toISOString()} ${prefix}${text}`);
|
|
59727
59827
|
if (!task.output) task.output = "";
|
|
59728
59828
|
task.output += text;
|
|
59729
59829
|
};
|
|
@@ -59761,7 +59861,7 @@ var init_headless = __esm({
|
|
|
59761
59861
|
}
|
|
59762
59862
|
this.saveTasks();
|
|
59763
59863
|
this.sendNotifications(task);
|
|
59764
|
-
|
|
59864
|
+
resolve11(task);
|
|
59765
59865
|
});
|
|
59766
59866
|
child.on("error", (error3) => {
|
|
59767
59867
|
clearTimeout(timeoutId);
|
|
@@ -59770,7 +59870,7 @@ var init_headless = __esm({
|
|
|
59770
59870
|
task.completedAt = /* @__PURE__ */ new Date();
|
|
59771
59871
|
task.error = error3.message;
|
|
59772
59872
|
this.saveTasks();
|
|
59773
|
-
|
|
59873
|
+
resolve11(task);
|
|
59774
59874
|
});
|
|
59775
59875
|
});
|
|
59776
59876
|
}
|
|
@@ -59923,6 +60023,48 @@ var init_headless = __esm({
|
|
|
59923
60023
|
}
|
|
59924
60024
|
});
|
|
59925
60025
|
|
|
60026
|
+
// src/commands/init.ts
|
|
60027
|
+
function createInitCommand() {
|
|
60028
|
+
return new Command("init").description("Initialize current directory for GAL auto-sync").option("-d, --directory <path>", "Directory to initialize", process.cwd()).option("--remove", "Remove GAL auto-sync initialization for this directory").action((options) => {
|
|
60029
|
+
const targetDirectory = (0, import_path28.resolve)(options.directory || process.cwd());
|
|
60030
|
+
if (options.remove) {
|
|
60031
|
+
const result2 = removeInitializedDirectory(targetDirectory);
|
|
60032
|
+
if (result2.removed) {
|
|
60033
|
+
console.log(source_default.green(`\u2713 GAL auto-sync removed for: ${result2.directory}`));
|
|
60034
|
+
} else {
|
|
60035
|
+
console.log(source_default.dim(`GAL auto-sync was not initialized for: ${result2.directory}`));
|
|
60036
|
+
}
|
|
60037
|
+
if (result2.prunedStaleEntries > 0) {
|
|
60038
|
+
console.log(source_default.dim(`Pruned ${result2.prunedStaleEntries} stale registry entr${result2.prunedStaleEntries === 1 ? "y" : "ies"}.`));
|
|
60039
|
+
}
|
|
60040
|
+
console.log(source_default.dim(`Registry: ${getSyncInitializationRegistryPath()}`));
|
|
60041
|
+
return;
|
|
60042
|
+
}
|
|
60043
|
+
const result = initializeDirectory(targetDirectory);
|
|
60044
|
+
if (result.alreadyInitialized) {
|
|
60045
|
+
console.log(source_default.dim(`GAL auto-sync already initialized for: ${result.directory}`));
|
|
60046
|
+
} else {
|
|
60047
|
+
console.log(source_default.green(`\u2713 GAL auto-sync initialized for: ${result.directory}`));
|
|
60048
|
+
}
|
|
60049
|
+
if (result.prunedStaleEntries > 0) {
|
|
60050
|
+
console.log(source_default.dim(`Pruned ${result.prunedStaleEntries} stale registry entr${result.prunedStaleEntries === 1 ? "y" : "ies"}.`));
|
|
60051
|
+
}
|
|
60052
|
+
console.log(source_default.dim(`Initialized directories: ${result.totalInitialized}`));
|
|
60053
|
+
console.log(source_default.dim("Manual sync remains available anywhere: gal sync --pull"));
|
|
60054
|
+
console.log(source_default.dim(`Registry: ${getSyncInitializationRegistryPath()}`));
|
|
60055
|
+
});
|
|
60056
|
+
}
|
|
60057
|
+
var import_path28;
|
|
60058
|
+
var init_init = __esm({
|
|
60059
|
+
"src/commands/init.ts"() {
|
|
60060
|
+
"use strict";
|
|
60061
|
+
init_esm();
|
|
60062
|
+
init_source();
|
|
60063
|
+
import_path28 = require("path");
|
|
60064
|
+
init_sync_initialization();
|
|
60065
|
+
}
|
|
60066
|
+
});
|
|
60067
|
+
|
|
59926
60068
|
// src/commands/install.ts
|
|
59927
60069
|
function resolveInstallMethod(requestedMethod) {
|
|
59928
60070
|
if (!requestedMethod || requestedMethod === "auto") {
|
|
@@ -60167,7 +60309,7 @@ if __name__ == '__main__':
|
|
|
60167
60309
|
`;
|
|
60168
60310
|
}
|
|
60169
60311
|
function createJoinCommand() {
|
|
60170
|
-
const
|
|
60312
|
+
const join51 = new Command("join").description("Join an organization using an invite code (GAL-100)").option("-c, --code <code>", "Invite code (e.g., GAL-XXXX-XXXX)").option("-e, --email <email>", "Developer email (defaults to git config)").option("--skip-hooks", "Skip enforcement hook installation").option("--dry-run", "Validate invite without joining").action(async (options) => {
|
|
60171
60313
|
const spinner = ora();
|
|
60172
60314
|
if (!options.code) {
|
|
60173
60315
|
console.log(source_default.bold("\nGAL Developer Onboarding\n"));
|
|
@@ -60283,7 +60425,7 @@ Error: ${useResult.error || "Unknown error"}`));
|
|
|
60283
60425
|
process.exit(1);
|
|
60284
60426
|
}
|
|
60285
60427
|
});
|
|
60286
|
-
return
|
|
60428
|
+
return join51;
|
|
60287
60429
|
}
|
|
60288
60430
|
var import_node_os5, import_node_child_process2, import_node_crypto3, import_promises6, import_node_path4, defaultApiUrl9;
|
|
60289
60431
|
var init_join = __esm({
|
|
@@ -60610,10 +60752,10 @@ function parseMcpJsonRpcBody(body) {
|
|
|
60610
60752
|
return null;
|
|
60611
60753
|
}
|
|
60612
60754
|
function readMcpConfig(mcpPath) {
|
|
60613
|
-
if (!(0,
|
|
60755
|
+
if (!(0, import_fs29.existsSync)(mcpPath)) {
|
|
60614
60756
|
return { mcpServers: {} };
|
|
60615
60757
|
}
|
|
60616
|
-
const raw = (0,
|
|
60758
|
+
const raw = (0, import_fs29.readFileSync)(mcpPath, "utf-8");
|
|
60617
60759
|
const parsed = JSON.parse(raw);
|
|
60618
60760
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
60619
60761
|
throw new Error(`${mcpPath} must be a JSON object`);
|
|
@@ -60669,11 +60811,11 @@ async function postMcpJsonRpc(endpoint, authToken, method, params, timeoutMs) {
|
|
|
60669
60811
|
}
|
|
60670
60812
|
async function runMcpDoctor(options = {}) {
|
|
60671
60813
|
const config2 = ConfigManager.load();
|
|
60672
|
-
const directory = (0,
|
|
60814
|
+
const directory = (0, import_path29.resolve)(options.directory || process.cwd());
|
|
60673
60815
|
const serverName = options.serverName || DEFAULT_SERVER_NAME;
|
|
60674
60816
|
const fallbackApiUrl = resolveApiUrl(options.apiUrl || config2.apiUrl || defaultApiUrl10);
|
|
60675
60817
|
let endpoint = buildMcpUrl(fallbackApiUrl);
|
|
60676
|
-
const mcpPath = (0,
|
|
60818
|
+
const mcpPath = (0, import_path29.join)(directory, ".mcp.json");
|
|
60677
60819
|
const authToken = options.authToken ?? config2.authToken;
|
|
60678
60820
|
const timeoutMs = options.timeoutMs ?? 1e4;
|
|
60679
60821
|
const result = {
|
|
@@ -60824,11 +60966,11 @@ MCP is healthy. ${result.toolsCount} GAL tools are available.
|
|
|
60824
60966
|
}
|
|
60825
60967
|
function createSetupCommand() {
|
|
60826
60968
|
return new Command("setup").description("Create or update .mcp.json with hosted GAL MCP server").option("--dir <path>", "Target directory (default: current directory)").option("--api-url <url>", "GAL API URL (default: config/default)").option("--server-name <name>", `MCP server key (default: ${DEFAULT_SERVER_NAME})`).option("--skip-doctor", "Skip running MCP diagnostics after setup").action(async (options) => {
|
|
60827
|
-
const directory = (0,
|
|
60969
|
+
const directory = (0, import_path29.resolve)(options.dir || process.cwd());
|
|
60828
60970
|
const serverName = options.serverName || DEFAULT_SERVER_NAME;
|
|
60829
60971
|
const config2 = ConfigManager.load();
|
|
60830
60972
|
const apiUrl = resolveApiUrl(options.apiUrl || config2.apiUrl || defaultApiUrl10);
|
|
60831
|
-
const mcpPath = (0,
|
|
60973
|
+
const mcpPath = (0, import_path29.join)(directory, ".mcp.json");
|
|
60832
60974
|
let existing = { mcpServers: {} };
|
|
60833
60975
|
try {
|
|
60834
60976
|
existing = readMcpConfig(mcpPath);
|
|
@@ -60837,8 +60979,8 @@ function createSetupCommand() {
|
|
|
60837
60979
|
process.exit(1);
|
|
60838
60980
|
}
|
|
60839
60981
|
const next = upsertHostedGalServer(existing, serverName, apiUrl);
|
|
60840
|
-
(0,
|
|
60841
|
-
(0,
|
|
60982
|
+
(0, import_fs29.mkdirSync)(directory, { recursive: true });
|
|
60983
|
+
(0, import_fs29.writeFileSync)(mcpPath, JSON.stringify(next, null, 2) + "\n", "utf-8");
|
|
60842
60984
|
console.log(source_default.green(`\u2713 Updated ${mcpPath}`));
|
|
60843
60985
|
console.log(source_default.dim(` mcpServers.${serverName}.url = ${buildMcpUrl(apiUrl)}
|
|
60844
60986
|
`));
|
|
@@ -60887,15 +61029,15 @@ function createDoctorCommand() {
|
|
|
60887
61029
|
function createMcpCommand() {
|
|
60888
61030
|
return new Command("mcp").description("Set up and validate GAL hosted MCP connectivity").addCommand(createSetupCommand()).addCommand(createDoctorCommand());
|
|
60889
61031
|
}
|
|
60890
|
-
var
|
|
61032
|
+
var import_fs29, import_path29, DEFAULT_SERVER_NAME, defaultApiUrl10;
|
|
60891
61033
|
var init_mcp = __esm({
|
|
60892
61034
|
"src/commands/mcp.ts"() {
|
|
60893
61035
|
"use strict";
|
|
60894
61036
|
init_esm();
|
|
60895
61037
|
init_source();
|
|
60896
61038
|
init_ora();
|
|
60897
|
-
|
|
60898
|
-
|
|
61039
|
+
import_fs29 = require("fs");
|
|
61040
|
+
import_path29 = require("path");
|
|
60899
61041
|
init_config_manager();
|
|
60900
61042
|
init_constants();
|
|
60901
61043
|
DEFAULT_SERVER_NAME = "gal";
|
|
@@ -60906,12 +61048,12 @@ var init_mcp = __esm({
|
|
|
60906
61048
|
// src/commands/memory.ts
|
|
60907
61049
|
function parseClaudeMemoryFile(filePath) {
|
|
60908
61050
|
try {
|
|
60909
|
-
const raw = (0,
|
|
61051
|
+
const raw = (0, import_fs30.readFileSync)(filePath, "utf-8");
|
|
60910
61052
|
const frontmatterMatch = raw.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
|
|
60911
61053
|
if (!frontmatterMatch) {
|
|
60912
61054
|
return {
|
|
60913
|
-
name: (0,
|
|
60914
|
-
description: (0,
|
|
61055
|
+
name: (0, import_path30.basename)(filePath, ".md"),
|
|
61056
|
+
description: (0, import_path30.basename)(filePath, ".md").replace(/[-_]/g, " "),
|
|
60915
61057
|
type: "project",
|
|
60916
61058
|
content: raw.trim(),
|
|
60917
61059
|
source: "claude"
|
|
@@ -60925,8 +61067,8 @@ function parseClaudeMemoryFile(filePath) {
|
|
|
60925
61067
|
const memType = getType?.[1]?.trim();
|
|
60926
61068
|
const validTypes = ["user", "feedback", "project", "reference"];
|
|
60927
61069
|
return {
|
|
60928
|
-
name: getName?.[1]?.trim() || (0,
|
|
60929
|
-
description: getDesc?.[1]?.trim() || (0,
|
|
61070
|
+
name: getName?.[1]?.trim() || (0, import_path30.basename)(filePath, ".md"),
|
|
61071
|
+
description: getDesc?.[1]?.trim() || (0, import_path30.basename)(filePath, ".md").replace(/[-_]/g, " "),
|
|
60930
61072
|
type: validTypes.includes(memType) ? memType : "project",
|
|
60931
61073
|
content: body,
|
|
60932
61074
|
source: "claude",
|
|
@@ -60940,22 +61082,22 @@ function discoverMemoryFiles(projectRoot, platform5, includeGlobal) {
|
|
|
60940
61082
|
const files = [];
|
|
60941
61083
|
const pattern = PLATFORM_PATTERNS[platform5];
|
|
60942
61084
|
if (pattern.memoryDir) {
|
|
60943
|
-
const memDir = (0,
|
|
60944
|
-
if ((0,
|
|
61085
|
+
const memDir = (0, import_path30.join)(projectRoot, pattern.directory, pattern.memoryDir);
|
|
61086
|
+
if ((0, import_fs30.existsSync)(memDir) && (0, import_fs30.statSync)(memDir).isDirectory()) {
|
|
60945
61087
|
scanMemoryDir(memDir, projectRoot, files, false);
|
|
60946
61088
|
}
|
|
60947
61089
|
}
|
|
60948
61090
|
if (includeGlobal) {
|
|
60949
|
-
const home = (0,
|
|
61091
|
+
const home = (0, import_os20.homedir)();
|
|
60950
61092
|
if (platform5 === "claude") {
|
|
60951
|
-
const projectsDir = (0,
|
|
60952
|
-
if ((0,
|
|
61093
|
+
const projectsDir = (0, import_path30.join)(home, ".claude", "projects");
|
|
61094
|
+
if ((0, import_fs30.existsSync)(projectsDir)) {
|
|
60953
61095
|
try {
|
|
60954
|
-
const projectDirs = (0,
|
|
61096
|
+
const projectDirs = (0, import_fs30.readdirSync)(projectsDir, { withFileTypes: true });
|
|
60955
61097
|
for (const projDir of projectDirs) {
|
|
60956
61098
|
if (!projDir.isDirectory()) continue;
|
|
60957
|
-
const memDir = (0,
|
|
60958
|
-
if ((0,
|
|
61099
|
+
const memDir = (0, import_path30.join)(projectsDir, projDir.name, "memory");
|
|
61100
|
+
if ((0, import_fs30.existsSync)(memDir) && (0, import_fs30.statSync)(memDir).isDirectory()) {
|
|
60959
61101
|
scanMemoryDir(memDir, home, files, true);
|
|
60960
61102
|
}
|
|
60961
61103
|
}
|
|
@@ -60963,8 +61105,8 @@ function discoverMemoryFiles(projectRoot, platform5, includeGlobal) {
|
|
|
60963
61105
|
}
|
|
60964
61106
|
}
|
|
60965
61107
|
} else if (platform5 === "windsurf") {
|
|
60966
|
-
const memoriesDir = (0,
|
|
60967
|
-
if ((0,
|
|
61108
|
+
const memoriesDir = (0, import_path30.join)(home, ".codeium", "windsurf", "memories");
|
|
61109
|
+
if ((0, import_fs30.existsSync)(memoriesDir)) {
|
|
60968
61110
|
scanMemoryDir(memoriesDir, home, files, true);
|
|
60969
61111
|
}
|
|
60970
61112
|
}
|
|
@@ -60973,16 +61115,16 @@ function discoverMemoryFiles(projectRoot, platform5, includeGlobal) {
|
|
|
60973
61115
|
}
|
|
60974
61116
|
function scanMemoryDir(dir, rootDir, files, isGlobal) {
|
|
60975
61117
|
try {
|
|
60976
|
-
const entries = (0,
|
|
61118
|
+
const entries = (0, import_fs30.readdirSync)(dir, { withFileTypes: true });
|
|
60977
61119
|
for (const entry of entries) {
|
|
60978
|
-
const fullPath = (0,
|
|
61120
|
+
const fullPath = (0, import_path30.join)(dir, entry.name);
|
|
60979
61121
|
if (entry.isDirectory()) {
|
|
60980
61122
|
scanMemoryDir(fullPath, rootDir, files, isGlobal);
|
|
60981
61123
|
} else if (entry.isFile() && (entry.name.endsWith(".md") || entry.name.endsWith(".json"))) {
|
|
60982
61124
|
if (entry.name === "MEMORY.md") continue;
|
|
60983
61125
|
files.push({
|
|
60984
61126
|
path: fullPath,
|
|
60985
|
-
relativePath: (0,
|
|
61127
|
+
relativePath: (0, import_path30.relative)(rootDir, fullPath),
|
|
60986
61128
|
isGlobal
|
|
60987
61129
|
});
|
|
60988
61130
|
}
|
|
@@ -61067,9 +61209,9 @@ Notes:
|
|
|
61067
61209
|
mem = parseClaudeMemoryFile(file.path);
|
|
61068
61210
|
} else {
|
|
61069
61211
|
try {
|
|
61070
|
-
const content = (0,
|
|
61212
|
+
const content = (0, import_fs30.readFileSync)(file.path, "utf-8");
|
|
61071
61213
|
mem = {
|
|
61072
|
-
name: (0,
|
|
61214
|
+
name: (0, import_path30.basename)(file.path, ".md").replace(/[-_]/g, "-"),
|
|
61073
61215
|
description: `Imported from ${source}: ${file.relativePath}`,
|
|
61074
61216
|
type: "project",
|
|
61075
61217
|
content: content.trim(),
|
|
@@ -61186,15 +61328,15 @@ Notes:
|
|
|
61186
61328
|
});
|
|
61187
61329
|
return command;
|
|
61188
61330
|
}
|
|
61189
|
-
var
|
|
61331
|
+
var import_fs30, import_path30, import_os20;
|
|
61190
61332
|
var init_memory2 = __esm({
|
|
61191
61333
|
"src/commands/memory.ts"() {
|
|
61192
61334
|
"use strict";
|
|
61193
61335
|
init_esm();
|
|
61194
61336
|
init_source();
|
|
61195
|
-
|
|
61196
|
-
|
|
61197
|
-
|
|
61337
|
+
import_fs30 = require("fs");
|
|
61338
|
+
import_path30 = require("path");
|
|
61339
|
+
import_os20 = require("os");
|
|
61198
61340
|
init_dist2();
|
|
61199
61341
|
init_project_detection();
|
|
61200
61342
|
init_gal_config_service();
|
|
@@ -61720,21 +61862,21 @@ var init_policy = __esm({
|
|
|
61720
61862
|
async function readLocalConfig() {
|
|
61721
61863
|
const projectRoot = findProjectRoot();
|
|
61722
61864
|
const canonicalSources = [
|
|
61723
|
-
{ path: (0,
|
|
61724
|
-
{ path: (0,
|
|
61865
|
+
{ path: (0, import_path31.join)(projectRoot, ".gal", "config.yaml"), label: ".gal/config.yaml" },
|
|
61866
|
+
{ path: (0, import_path31.join)((0, import_os21.homedir)(), ".gal", "config.yaml"), label: "~/.gal/config.yaml" }
|
|
61725
61867
|
];
|
|
61726
61868
|
for (const source of canonicalSources) {
|
|
61727
|
-
if (!(0,
|
|
61869
|
+
if (!(0, import_fs31.existsSync)(source.path)) continue;
|
|
61728
61870
|
try {
|
|
61729
|
-
const content = (0,
|
|
61871
|
+
const content = (0, import_fs31.readFileSync)(source.path, "utf-8");
|
|
61730
61872
|
const config2 = (0, import_yaml2.parse)(content);
|
|
61731
61873
|
return config2;
|
|
61732
61874
|
} catch (error3) {
|
|
61733
61875
|
console.warn(`Failed to parse ${source.label}:`, error3);
|
|
61734
61876
|
}
|
|
61735
61877
|
}
|
|
61736
|
-
const claudeDir = (0,
|
|
61737
|
-
if (!(0,
|
|
61878
|
+
const claudeDir = (0, import_path31.join)(projectRoot, ".claude");
|
|
61879
|
+
if (!(0, import_fs31.existsSync)(claudeDir)) {
|
|
61738
61880
|
return null;
|
|
61739
61881
|
}
|
|
61740
61882
|
return constructConfigFromClaudeDir(claudeDir);
|
|
@@ -61747,10 +61889,10 @@ function constructConfigFromClaudeDir(claudeDir) {
|
|
|
61747
61889
|
hash: "",
|
|
61748
61890
|
syncedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
61749
61891
|
};
|
|
61750
|
-
const settingsPath = (0,
|
|
61751
|
-
if ((0,
|
|
61892
|
+
const settingsPath = (0, import_path31.join)(claudeDir, "settings.json");
|
|
61893
|
+
if ((0, import_fs31.existsSync)(settingsPath)) {
|
|
61752
61894
|
try {
|
|
61753
|
-
const settingsContent = (0,
|
|
61895
|
+
const settingsContent = (0, import_fs31.readFileSync)(settingsPath, "utf-8");
|
|
61754
61896
|
let claudeSettings;
|
|
61755
61897
|
try {
|
|
61756
61898
|
claudeSettings = JSON.parse(settingsContent);
|
|
@@ -61766,24 +61908,24 @@ function constructConfigFromClaudeDir(claudeDir) {
|
|
|
61766
61908
|
console.warn("Failed to read .claude/settings.json:", error3);
|
|
61767
61909
|
}
|
|
61768
61910
|
}
|
|
61769
|
-
const claudeMdPath = (0,
|
|
61770
|
-
if ((0,
|
|
61911
|
+
const claudeMdPath = (0, import_path31.join)(claudeDir, "..", "CLAUDE.md");
|
|
61912
|
+
if ((0, import_fs31.existsSync)(claudeMdPath)) {
|
|
61771
61913
|
try {
|
|
61772
|
-
const claudeMdContent = (0,
|
|
61914
|
+
const claudeMdContent = (0, import_fs31.readFileSync)(claudeMdPath, "utf-8");
|
|
61773
61915
|
config2.instructions = { content: claudeMdContent };
|
|
61774
61916
|
} catch (error3) {
|
|
61775
61917
|
console.warn("Failed to read CLAUDE.md:", error3);
|
|
61776
61918
|
}
|
|
61777
61919
|
}
|
|
61778
|
-
const commandsDir = (0,
|
|
61779
|
-
if ((0,
|
|
61920
|
+
const commandsDir = (0, import_path31.join)(claudeDir, "commands");
|
|
61921
|
+
if ((0, import_fs31.existsSync)(commandsDir)) {
|
|
61780
61922
|
config2.commands = [];
|
|
61781
61923
|
try {
|
|
61782
61924
|
const commandFiles = readDirRecursive(commandsDir, ".md");
|
|
61783
61925
|
for (const file of commandFiles) {
|
|
61784
61926
|
const relativePath = file.replace(commandsDir + "/", "");
|
|
61785
61927
|
const commandName = relativePath.replace(/\.md$/, "").replace(/\//g, ":");
|
|
61786
|
-
const content = (0,
|
|
61928
|
+
const content = (0, import_fs31.readFileSync)(file, "utf-8");
|
|
61787
61929
|
config2.commands.push({
|
|
61788
61930
|
name: commandName,
|
|
61789
61931
|
content
|
|
@@ -61793,14 +61935,14 @@ function constructConfigFromClaudeDir(claudeDir) {
|
|
|
61793
61935
|
console.warn("Failed to read .claude/commands/:", error3);
|
|
61794
61936
|
}
|
|
61795
61937
|
}
|
|
61796
|
-
const rulesDir = (0,
|
|
61797
|
-
if ((0,
|
|
61938
|
+
const rulesDir = (0, import_path31.join)(claudeDir, "rules");
|
|
61939
|
+
if ((0, import_fs31.existsSync)(rulesDir)) {
|
|
61798
61940
|
config2.rules = [];
|
|
61799
61941
|
try {
|
|
61800
|
-
const ruleFiles = (0,
|
|
61942
|
+
const ruleFiles = (0, import_fs31.readdirSync)(rulesDir).filter((f) => f.endsWith(".md"));
|
|
61801
61943
|
for (const file of ruleFiles) {
|
|
61802
61944
|
const ruleName = file.replace(/\.md$/, "");
|
|
61803
|
-
const content = (0,
|
|
61945
|
+
const content = (0, import_fs31.readFileSync)((0, import_path31.join)(rulesDir, file), "utf-8");
|
|
61804
61946
|
config2.rules.push({
|
|
61805
61947
|
name: ruleName,
|
|
61806
61948
|
content
|
|
@@ -61810,13 +61952,13 @@ function constructConfigFromClaudeDir(claudeDir) {
|
|
|
61810
61952
|
console.warn("Failed to read .claude/rules/:", error3);
|
|
61811
61953
|
}
|
|
61812
61954
|
}
|
|
61813
|
-
const hooksDir = (0,
|
|
61814
|
-
if ((0,
|
|
61955
|
+
const hooksDir = (0, import_path31.join)(claudeDir, "hooks");
|
|
61956
|
+
if ((0, import_fs31.existsSync)(hooksDir)) {
|
|
61815
61957
|
config2.hooks = [];
|
|
61816
61958
|
try {
|
|
61817
|
-
const hookFiles = (0,
|
|
61959
|
+
const hookFiles = (0, import_fs31.readdirSync)(hooksDir).filter((f) => f.endsWith(".js") || f.endsWith(".py") || f.endsWith(".sh"));
|
|
61818
61960
|
for (const file of hookFiles) {
|
|
61819
|
-
const content = (0,
|
|
61961
|
+
const content = (0, import_fs31.readFileSync)((0, import_path31.join)(hooksDir, file), "utf-8");
|
|
61820
61962
|
config2.hooks.push({
|
|
61821
61963
|
name: file,
|
|
61822
61964
|
event: "PreToolUse",
|
|
@@ -61828,15 +61970,15 @@ function constructConfigFromClaudeDir(claudeDir) {
|
|
|
61828
61970
|
console.warn("Failed to read .claude/hooks/:", error3);
|
|
61829
61971
|
}
|
|
61830
61972
|
}
|
|
61831
|
-
const agentsDir = (0,
|
|
61832
|
-
if ((0,
|
|
61973
|
+
const agentsDir = (0, import_path31.join)(claudeDir, "agents");
|
|
61974
|
+
if ((0, import_fs31.existsSync)(agentsDir)) {
|
|
61833
61975
|
config2.agents = [];
|
|
61834
61976
|
try {
|
|
61835
61977
|
const agentFiles = readDirRecursive(agentsDir, ".md");
|
|
61836
61978
|
for (const file of agentFiles) {
|
|
61837
61979
|
const relativePath = file.replace(agentsDir + "/", "");
|
|
61838
61980
|
const agentName = relativePath.replace(/\.md$/, "").replace(/\//g, ":");
|
|
61839
|
-
const content = (0,
|
|
61981
|
+
const content = (0, import_fs31.readFileSync)(file, "utf-8");
|
|
61840
61982
|
config2.agents.push({
|
|
61841
61983
|
name: agentName,
|
|
61842
61984
|
content
|
|
@@ -61855,10 +61997,10 @@ function constructConfigFromClaudeDir(claudeDir) {
|
|
|
61855
61997
|
function readDirRecursive(dir, extension) {
|
|
61856
61998
|
const results = [];
|
|
61857
61999
|
try {
|
|
61858
|
-
const files = (0,
|
|
62000
|
+
const files = (0, import_fs31.readdirSync)(dir);
|
|
61859
62001
|
for (const file of files) {
|
|
61860
|
-
const filePath = (0,
|
|
61861
|
-
const stat5 = (0,
|
|
62002
|
+
const filePath = (0, import_path31.join)(dir, file);
|
|
62003
|
+
const stat5 = (0, import_fs31.statSync)(filePath);
|
|
61862
62004
|
if (stat5.isDirectory()) {
|
|
61863
62005
|
results.push(...readDirRecursive(filePath, extension));
|
|
61864
62006
|
} else if (file.endsWith(extension)) {
|
|
@@ -61869,13 +62011,13 @@ function readDirRecursive(dir, extension) {
|
|
|
61869
62011
|
}
|
|
61870
62012
|
return results;
|
|
61871
62013
|
}
|
|
61872
|
-
var
|
|
62014
|
+
var import_fs31, import_path31, import_os21, import_yaml2;
|
|
61873
62015
|
var init_config_reader = __esm({
|
|
61874
62016
|
"src/utils/config-reader.ts"() {
|
|
61875
62017
|
"use strict";
|
|
61876
|
-
|
|
61877
|
-
|
|
61878
|
-
|
|
62018
|
+
import_fs31 = require("fs");
|
|
62019
|
+
import_path31 = require("path");
|
|
62020
|
+
import_os21 = require("os");
|
|
61879
62021
|
init_project_detection();
|
|
61880
62022
|
import_yaml2 = __toESM(require_dist2(), 1);
|
|
61881
62023
|
}
|
|
@@ -61885,8 +62027,8 @@ var init_config_reader = __esm({
|
|
|
61885
62027
|
function getGitRepoInfo() {
|
|
61886
62028
|
try {
|
|
61887
62029
|
const projectRoot = findProjectRoot();
|
|
61888
|
-
const gitDir = (0,
|
|
61889
|
-
if (!(0,
|
|
62030
|
+
const gitDir = (0, import_path32.join)(projectRoot, ".git");
|
|
62031
|
+
if (!(0, import_fs32.existsSync)(gitDir)) {
|
|
61890
62032
|
return { isRepo: false };
|
|
61891
62033
|
}
|
|
61892
62034
|
const remoteUrl = (0, import_child_process10.execSync)("git remote get-url origin", {
|
|
@@ -62019,7 +62161,7 @@ function createProposeCommand() {
|
|
|
62019
62161
|
});
|
|
62020
62162
|
return command;
|
|
62021
62163
|
}
|
|
62022
|
-
var
|
|
62164
|
+
var import_fs32, import_path32, import_child_process10;
|
|
62023
62165
|
var init_propose = __esm({
|
|
62024
62166
|
"src/commands/propose.ts"() {
|
|
62025
62167
|
"use strict";
|
|
@@ -62030,8 +62172,8 @@ var init_propose = __esm({
|
|
|
62030
62172
|
init_CoreServiceProvider();
|
|
62031
62173
|
init_config_reader();
|
|
62032
62174
|
init_project_detection();
|
|
62033
|
-
|
|
62034
|
-
|
|
62175
|
+
import_fs32 = require("fs");
|
|
62176
|
+
import_path32 = require("path");
|
|
62035
62177
|
import_child_process10 = require("child_process");
|
|
62036
62178
|
}
|
|
62037
62179
|
});
|
|
@@ -62164,7 +62306,7 @@ function createProtectCommand() {
|
|
|
62164
62306
|
new Command("analyze").description("Analyze execution logs for recursion patterns").option("-f, --file <path>", "Log file to analyze").option("-p, --path <path>", "Project path", process.cwd()).action(async (options) => {
|
|
62165
62307
|
const spinner = ora("Analyzing execution patterns...").start();
|
|
62166
62308
|
try {
|
|
62167
|
-
await new Promise((
|
|
62309
|
+
await new Promise((resolve11) => setTimeout(resolve11, 1e3));
|
|
62168
62310
|
spinner.stop();
|
|
62169
62311
|
console.log(source_default.blue.bold("\nRecursion Pattern Analysis\n"));
|
|
62170
62312
|
console.log("\u2500".repeat(50));
|
|
@@ -62716,7 +62858,7 @@ function createAddCommand() {
|
|
|
62716
62858
|
let prompt2 = promptArg;
|
|
62717
62859
|
if (options.promptFile) {
|
|
62718
62860
|
try {
|
|
62719
|
-
prompt2 = (0,
|
|
62861
|
+
prompt2 = (0, import_fs33.readFileSync)(options.promptFile, "utf-8").trim();
|
|
62720
62862
|
} catch (err) {
|
|
62721
62863
|
console.error(source_default.red(`Error reading prompt file: ${err instanceof Error ? err.message : String(err)}`));
|
|
62722
62864
|
process.exit(1);
|
|
@@ -62963,14 +63105,14 @@ function createCancelCommand() {
|
|
|
62963
63105
|
}
|
|
62964
63106
|
});
|
|
62965
63107
|
}
|
|
62966
|
-
var
|
|
63108
|
+
var import_fs33, defaultApiUrl12, PRIORITY_LABELS, PRIORITY_COLORS, STATUS_COLORS;
|
|
62967
63109
|
var init_queue_mgmt = __esm({
|
|
62968
63110
|
"src/commands/queue-mgmt.ts"() {
|
|
62969
63111
|
"use strict";
|
|
62970
63112
|
init_esm();
|
|
62971
63113
|
init_source();
|
|
62972
63114
|
init_ora();
|
|
62973
|
-
|
|
63115
|
+
import_fs33 = require("fs");
|
|
62974
63116
|
init_constants();
|
|
62975
63117
|
init_config_manager();
|
|
62976
63118
|
init_client();
|
|
@@ -63214,11 +63356,11 @@ function createSeedCommand() {
|
|
|
63214
63356
|
}
|
|
63215
63357
|
let template = options.template;
|
|
63216
63358
|
if (options.templateFile) {
|
|
63217
|
-
if (!(0,
|
|
63359
|
+
if (!(0, import_fs34.existsSync)(options.templateFile)) {
|
|
63218
63360
|
console.error(source_default.red(`Error: Template file not found: ${options.templateFile}`));
|
|
63219
63361
|
process.exit(1);
|
|
63220
63362
|
}
|
|
63221
|
-
template = (0,
|
|
63363
|
+
template = (0, import_fs34.readFileSync)(options.templateFile, "utf-8").trim();
|
|
63222
63364
|
}
|
|
63223
63365
|
const config2 = ConfigManager.load();
|
|
63224
63366
|
const apiUrl = config2.apiUrl ?? process.env.GAL_API_URL ?? defaultApiUrl13;
|
|
@@ -63234,13 +63376,13 @@ function createSeedCommand() {
|
|
|
63234
63376
|
});
|
|
63235
63377
|
if (options.file) {
|
|
63236
63378
|
const filePath = options.file;
|
|
63237
|
-
if (!(0,
|
|
63379
|
+
if (!(0, import_fs34.existsSync)(filePath)) {
|
|
63238
63380
|
console.error(source_default.red(`Error: File not found: ${filePath}`));
|
|
63239
63381
|
process.exit(1);
|
|
63240
63382
|
}
|
|
63241
63383
|
let items = [];
|
|
63242
63384
|
try {
|
|
63243
|
-
const raw = (0,
|
|
63385
|
+
const raw = (0, import_fs34.readFileSync)(filePath, "utf-8");
|
|
63244
63386
|
const parsed = JSON.parse(raw);
|
|
63245
63387
|
if (!Array.isArray(parsed)) {
|
|
63246
63388
|
console.error(source_default.red("Error: JSON file must contain an array of work items."));
|
|
@@ -63405,14 +63547,14 @@ function createQueueCommand() {
|
|
|
63405
63547
|
cmd.addCommand(createSeedCommand());
|
|
63406
63548
|
return cmd;
|
|
63407
63549
|
}
|
|
63408
|
-
var
|
|
63550
|
+
var import_fs34, defaultApiUrl13, GH_API_BASE, DEFAULT_TEMPLATE_BY_LABEL, DEFAULT_TEMPLATE;
|
|
63409
63551
|
var init_queue_seed = __esm({
|
|
63410
63552
|
"src/commands/queue-seed.ts"() {
|
|
63411
63553
|
"use strict";
|
|
63412
63554
|
init_esm();
|
|
63413
63555
|
init_source();
|
|
63414
63556
|
init_ora();
|
|
63415
|
-
|
|
63557
|
+
import_fs34 = require("fs");
|
|
63416
63558
|
init_config_manager();
|
|
63417
63559
|
init_constants();
|
|
63418
63560
|
init_client();
|
|
@@ -63603,10 +63745,10 @@ function parseFrontmatter(content) {
|
|
|
63603
63745
|
};
|
|
63604
63746
|
}
|
|
63605
63747
|
function parseCommandFile(filePath) {
|
|
63606
|
-
const content = (0,
|
|
63748
|
+
const content = (0, import_fs35.readFileSync)(filePath, "utf-8");
|
|
63607
63749
|
const { metadata, body } = parseFrontmatter(content);
|
|
63608
|
-
const fileName = (0,
|
|
63609
|
-
const name = (0,
|
|
63750
|
+
const fileName = (0, import_path33.basename)(filePath);
|
|
63751
|
+
const name = (0, import_path33.basename)(filePath, (0, import_path33.extname)(filePath));
|
|
63610
63752
|
return {
|
|
63611
63753
|
name,
|
|
63612
63754
|
fileName,
|
|
@@ -63619,10 +63761,10 @@ function parseCommandFile(filePath) {
|
|
|
63619
63761
|
function findCommandFiles(dir, recursive = true) {
|
|
63620
63762
|
const files = [];
|
|
63621
63763
|
try {
|
|
63622
|
-
const entries = (0,
|
|
63764
|
+
const entries = (0, import_fs35.readdirSync)(dir);
|
|
63623
63765
|
for (const entry of entries) {
|
|
63624
|
-
const fullPath = (0,
|
|
63625
|
-
const stats = (0,
|
|
63766
|
+
const fullPath = (0, import_path33.join)(dir, entry);
|
|
63767
|
+
const stats = (0, import_fs35.statSync)(fullPath);
|
|
63626
63768
|
if (stats.isDirectory()) {
|
|
63627
63769
|
if (entry.startsWith(".") || entry === "node_modules" || entry === ".templates") {
|
|
63628
63770
|
continue;
|
|
@@ -63697,12 +63839,12 @@ function substituteArguments(commandBody, args2) {
|
|
|
63697
63839
|
}
|
|
63698
63840
|
return result;
|
|
63699
63841
|
}
|
|
63700
|
-
var
|
|
63842
|
+
var import_fs35, import_path33;
|
|
63701
63843
|
var init_command_parser = __esm({
|
|
63702
63844
|
"src/parser/command-parser.ts"() {
|
|
63703
63845
|
"use strict";
|
|
63704
|
-
|
|
63705
|
-
|
|
63846
|
+
import_fs35 = require("fs");
|
|
63847
|
+
import_path33 = require("path");
|
|
63706
63848
|
}
|
|
63707
63849
|
});
|
|
63708
63850
|
|
|
@@ -63728,7 +63870,7 @@ function extractExecutableCommands(body) {
|
|
|
63728
63870
|
}
|
|
63729
63871
|
async function executeShellCommand(command, timeout) {
|
|
63730
63872
|
const { spawn: spawn6 } = await import("child_process");
|
|
63731
|
-
return new Promise((
|
|
63873
|
+
return new Promise((resolve11, reject) => {
|
|
63732
63874
|
const child = spawn6("sh", ["-c", command], {
|
|
63733
63875
|
env: process.env
|
|
63734
63876
|
});
|
|
@@ -63749,7 +63891,7 @@ async function executeShellCommand(command, timeout) {
|
|
|
63749
63891
|
child.on("close", (code) => {
|
|
63750
63892
|
if (timeoutId) clearTimeout(timeoutId);
|
|
63751
63893
|
if (!timedOut) {
|
|
63752
|
-
|
|
63894
|
+
resolve11({
|
|
63753
63895
|
stdout,
|
|
63754
63896
|
stderr,
|
|
63755
63897
|
exitCode: code ?? 0
|
|
@@ -63943,12 +64085,12 @@ var init_headless_executor = __esm({
|
|
|
63943
64085
|
|
|
63944
64086
|
// src/commands/run.ts
|
|
63945
64087
|
function findCommandsDirectory() {
|
|
63946
|
-
const localCommandsDir = (0,
|
|
63947
|
-
if ((0,
|
|
64088
|
+
const localCommandsDir = (0, import_path34.join)(process.cwd(), ".claude", "commands");
|
|
64089
|
+
if ((0, import_fs36.existsSync)(localCommandsDir)) {
|
|
63948
64090
|
return localCommandsDir;
|
|
63949
64091
|
}
|
|
63950
|
-
const homeCommandsDir = (0,
|
|
63951
|
-
if ((0,
|
|
64092
|
+
const homeCommandsDir = (0, import_path34.join)((0, import_os22.homedir)(), ".claude", "commands");
|
|
64093
|
+
if ((0, import_fs36.existsSync)(homeCommandsDir)) {
|
|
63952
64094
|
return homeCommandsDir;
|
|
63953
64095
|
}
|
|
63954
64096
|
return null;
|
|
@@ -64036,7 +64178,7 @@ async function handleRunCommand(commandName, args2, options) {
|
|
|
64036
64178
|
let commandsDir = options.dir || findCommandsDirectory();
|
|
64037
64179
|
let command;
|
|
64038
64180
|
if (options.file) {
|
|
64039
|
-
if (!(0,
|
|
64181
|
+
if (!(0, import_fs36.existsSync)(options.file)) {
|
|
64040
64182
|
console.error(source_default.red(`Error: Command file not found: ${options.file}`));
|
|
64041
64183
|
process.exit(1);
|
|
64042
64184
|
}
|
|
@@ -64118,16 +64260,16 @@ Executing command: ${command.name}`));
|
|
|
64118
64260
|
throw error3;
|
|
64119
64261
|
}
|
|
64120
64262
|
}
|
|
64121
|
-
var
|
|
64263
|
+
var import_os22, import_path34, import_fs36;
|
|
64122
64264
|
var init_run = __esm({
|
|
64123
64265
|
"src/commands/run.ts"() {
|
|
64124
64266
|
"use strict";
|
|
64125
64267
|
init_esm();
|
|
64126
64268
|
init_source();
|
|
64127
64269
|
init_ora();
|
|
64128
|
-
|
|
64129
|
-
|
|
64130
|
-
|
|
64270
|
+
import_os22 = require("os");
|
|
64271
|
+
import_path34 = require("path");
|
|
64272
|
+
import_fs36 = require("fs");
|
|
64131
64273
|
init_command_parser();
|
|
64132
64274
|
init_headless_executor();
|
|
64133
64275
|
}
|
|
@@ -64135,30 +64277,30 @@ var init_run = __esm({
|
|
|
64135
64277
|
|
|
64136
64278
|
// src/commands/run-design.ts
|
|
64137
64279
|
function ensureDir() {
|
|
64138
|
-
if (!(0,
|
|
64139
|
-
(0,
|
|
64280
|
+
if (!(0, import_fs37.existsSync)(DESIGN_PROJECTS_DIR)) {
|
|
64281
|
+
(0, import_fs37.mkdirSync)(DESIGN_PROJECTS_DIR, { recursive: true });
|
|
64140
64282
|
}
|
|
64141
64283
|
}
|
|
64142
64284
|
function projectPath(id) {
|
|
64143
|
-
return (0,
|
|
64285
|
+
return (0, import_path35.join)(DESIGN_PROJECTS_DIR, `${id}.json`);
|
|
64144
64286
|
}
|
|
64145
64287
|
function saveProject(project) {
|
|
64146
64288
|
ensureDir();
|
|
64147
|
-
(0,
|
|
64289
|
+
(0, import_fs37.writeFileSync)(projectPath(project.id), JSON.stringify(project, null, 2));
|
|
64148
64290
|
}
|
|
64149
64291
|
function loadProject(id) {
|
|
64150
64292
|
const p = projectPath(id);
|
|
64151
|
-
if (!(0,
|
|
64293
|
+
if (!(0, import_fs37.existsSync)(p)) return null;
|
|
64152
64294
|
try {
|
|
64153
|
-
return JSON.parse((0,
|
|
64295
|
+
return JSON.parse((0, import_fs37.readFileSync)(p, "utf-8"));
|
|
64154
64296
|
} catch {
|
|
64155
64297
|
return null;
|
|
64156
64298
|
}
|
|
64157
64299
|
}
|
|
64158
64300
|
function getActiveId() {
|
|
64159
|
-
if (!(0,
|
|
64301
|
+
if (!(0, import_fs37.existsSync)(ACTIVE_FILE)) return null;
|
|
64160
64302
|
try {
|
|
64161
|
-
const data = JSON.parse((0,
|
|
64303
|
+
const data = JSON.parse((0, import_fs37.readFileSync)(ACTIVE_FILE, "utf-8"));
|
|
64162
64304
|
return data.id ?? null;
|
|
64163
64305
|
} catch {
|
|
64164
64306
|
return null;
|
|
@@ -64166,7 +64308,7 @@ function getActiveId() {
|
|
|
64166
64308
|
}
|
|
64167
64309
|
function setActiveId(id) {
|
|
64168
64310
|
ensureDir();
|
|
64169
|
-
(0,
|
|
64311
|
+
(0, import_fs37.writeFileSync)(ACTIVE_FILE, JSON.stringify({ id }, null, 2));
|
|
64170
64312
|
}
|
|
64171
64313
|
function getActiveProject() {
|
|
64172
64314
|
const id = getActiveId();
|
|
@@ -64287,7 +64429,7 @@ function handleStatus(options) {
|
|
|
64287
64429
|
project = getActiveProject();
|
|
64288
64430
|
if (!project) {
|
|
64289
64431
|
ensureDir();
|
|
64290
|
-
const files = (0,
|
|
64432
|
+
const files = (0, import_fs37.readdirSync)(DESIGN_PROJECTS_DIR).filter(
|
|
64291
64433
|
(f) => f.endsWith(".json") && f !== "active.json"
|
|
64292
64434
|
);
|
|
64293
64435
|
if (files.length === 0) {
|
|
@@ -64402,8 +64544,8 @@ function handleSync() {
|
|
|
64402
64544
|
const project = getActiveProject();
|
|
64403
64545
|
if (!project) {
|
|
64404
64546
|
ensureDir();
|
|
64405
|
-
(0,
|
|
64406
|
-
(0,
|
|
64547
|
+
(0, import_fs37.writeFileSync)(
|
|
64548
|
+
(0, import_path35.join)(DESIGN_PROJECTS_DIR, "extension-sync.json"),
|
|
64407
64549
|
JSON.stringify(null, null, 2)
|
|
64408
64550
|
);
|
|
64409
64551
|
console.log(source_default.yellow("No active project. Extension card cleared."));
|
|
@@ -64420,8 +64562,8 @@ function handleSync() {
|
|
|
64420
64562
|
completedScenes: done
|
|
64421
64563
|
};
|
|
64422
64564
|
ensureDir();
|
|
64423
|
-
(0,
|
|
64424
|
-
(0,
|
|
64565
|
+
(0, import_fs37.writeFileSync)(
|
|
64566
|
+
(0, import_path35.join)(DESIGN_PROJECTS_DIR, "extension-sync.json"),
|
|
64425
64567
|
JSON.stringify(summary, null, 2)
|
|
64426
64568
|
);
|
|
64427
64569
|
console.log(source_default.green("\nSynced active project to extension:\n"));
|
|
@@ -64465,17 +64607,17 @@ function createRunDesignCommand() {
|
|
|
64465
64607
|
runDesign.addCommand(syncCmd);
|
|
64466
64608
|
return runDesign;
|
|
64467
64609
|
}
|
|
64468
|
-
var
|
|
64610
|
+
var import_os23, import_path35, import_fs37, DESIGN_PROJECTS_DIR, ACTIVE_FILE, IMAGE_STATUS_ICON, VIDEO_STATUS_ICON;
|
|
64469
64611
|
var init_run_design = __esm({
|
|
64470
64612
|
"src/commands/run-design.ts"() {
|
|
64471
64613
|
"use strict";
|
|
64472
64614
|
init_esm();
|
|
64473
64615
|
init_source();
|
|
64474
|
-
|
|
64475
|
-
|
|
64476
|
-
|
|
64477
|
-
DESIGN_PROJECTS_DIR = (0,
|
|
64478
|
-
ACTIVE_FILE = (0,
|
|
64616
|
+
import_os23 = require("os");
|
|
64617
|
+
import_path35 = require("path");
|
|
64618
|
+
import_fs37 = require("fs");
|
|
64619
|
+
DESIGN_PROJECTS_DIR = (0, import_path35.join)((0, import_os23.homedir)(), ".gal", "design-projects");
|
|
64620
|
+
ACTIVE_FILE = (0, import_path35.join)(DESIGN_PROJECTS_DIR, "active.json");
|
|
64479
64621
|
IMAGE_STATUS_ICON = {
|
|
64480
64622
|
pending: " ",
|
|
64481
64623
|
generating: " ",
|
|
@@ -64496,104 +64638,104 @@ var init_run_design = __esm({
|
|
|
64496
64638
|
function scanPlatform(rootDir, pattern) {
|
|
64497
64639
|
const configs = [];
|
|
64498
64640
|
const platform5 = pattern.platform;
|
|
64499
|
-
const platformDir = (0,
|
|
64641
|
+
const platformDir = (0, import_path36.join)(rootDir, pattern.directory);
|
|
64500
64642
|
if (pattern.settingsFile) {
|
|
64501
|
-
const settingsPath = (0,
|
|
64502
|
-
if ((0,
|
|
64643
|
+
const settingsPath = (0, import_path36.join)(platformDir, pattern.settingsFile);
|
|
64644
|
+
if ((0, import_fs38.existsSync)(settingsPath)) {
|
|
64503
64645
|
configs.push({
|
|
64504
64646
|
platform: platform5,
|
|
64505
64647
|
type: "settings",
|
|
64506
64648
|
name: pattern.settingsFile,
|
|
64507
64649
|
path: settingsPath,
|
|
64508
|
-
relativePath: (0,
|
|
64509
|
-
sizeBytes: (0,
|
|
64650
|
+
relativePath: (0, import_path36.relative)(rootDir, settingsPath),
|
|
64651
|
+
sizeBytes: (0, import_fs38.statSync)(settingsPath).size
|
|
64510
64652
|
});
|
|
64511
64653
|
}
|
|
64512
64654
|
}
|
|
64513
64655
|
if (pattern.configFile) {
|
|
64514
|
-
const configPath = (0,
|
|
64515
|
-
if ((0,
|
|
64656
|
+
const configPath = (0, import_path36.join)(platformDir, pattern.configFile);
|
|
64657
|
+
if ((0, import_fs38.existsSync)(configPath)) {
|
|
64516
64658
|
configs.push({
|
|
64517
64659
|
platform: platform5,
|
|
64518
64660
|
type: "settings",
|
|
64519
64661
|
name: pattern.configFile,
|
|
64520
64662
|
path: configPath,
|
|
64521
|
-
relativePath: (0,
|
|
64522
|
-
sizeBytes: (0,
|
|
64663
|
+
relativePath: (0, import_path36.relative)(rootDir, configPath),
|
|
64664
|
+
sizeBytes: (0, import_fs38.statSync)(configPath).size
|
|
64523
64665
|
});
|
|
64524
64666
|
}
|
|
64525
64667
|
}
|
|
64526
64668
|
if (pattern.rulesDir) {
|
|
64527
|
-
const rulesDir = (0,
|
|
64528
|
-
if ((0,
|
|
64669
|
+
const rulesDir = (0, import_path36.join)(platformDir, pattern.rulesDir);
|
|
64670
|
+
if ((0, import_fs38.existsSync)(rulesDir) && (0, import_fs38.statSync)(rulesDir).isDirectory()) {
|
|
64529
64671
|
scanDir(rulesDir, rootDir, platform5, "rules", pattern.ruleExtensions, configs);
|
|
64530
64672
|
}
|
|
64531
64673
|
}
|
|
64532
64674
|
if (pattern.rulesFile) {
|
|
64533
|
-
const rulesPath = (0,
|
|
64534
|
-
if ((0,
|
|
64675
|
+
const rulesPath = (0, import_path36.join)(platformDir, pattern.rulesFile);
|
|
64676
|
+
if ((0, import_fs38.existsSync)(rulesPath)) {
|
|
64535
64677
|
configs.push({
|
|
64536
64678
|
platform: platform5,
|
|
64537
64679
|
type: "rules",
|
|
64538
64680
|
name: pattern.rulesFile,
|
|
64539
64681
|
path: rulesPath,
|
|
64540
|
-
relativePath: (0,
|
|
64541
|
-
sizeBytes: (0,
|
|
64682
|
+
relativePath: (0, import_path36.relative)(rootDir, rulesPath),
|
|
64683
|
+
sizeBytes: (0, import_fs38.statSync)(rulesPath).size
|
|
64542
64684
|
});
|
|
64543
64685
|
}
|
|
64544
64686
|
}
|
|
64545
64687
|
if (pattern.commandsDir) {
|
|
64546
|
-
const commandsDir = (0,
|
|
64547
|
-
if ((0,
|
|
64688
|
+
const commandsDir = (0, import_path36.join)(platformDir, pattern.commandsDir);
|
|
64689
|
+
if ((0, import_fs38.existsSync)(commandsDir) && (0, import_fs38.statSync)(commandsDir).isDirectory()) {
|
|
64548
64690
|
scanDir(commandsDir, rootDir, platform5, "commands", [".md", ".toml"], configs);
|
|
64549
64691
|
}
|
|
64550
64692
|
}
|
|
64551
64693
|
if (pattern.hooksDir) {
|
|
64552
|
-
const hooksDir = (0,
|
|
64553
|
-
if ((0,
|
|
64694
|
+
const hooksDir = (0, import_path36.join)(platformDir, pattern.hooksDir);
|
|
64695
|
+
if ((0, import_fs38.existsSync)(hooksDir) && (0, import_fs38.statSync)(hooksDir).isDirectory()) {
|
|
64554
64696
|
scanDir(hooksDir, rootDir, platform5, "hooks", [".md", ".json", ".sh", ".ts", ".js"], configs);
|
|
64555
64697
|
}
|
|
64556
64698
|
}
|
|
64557
64699
|
if (pattern.hooksConfigFile) {
|
|
64558
|
-
const hooksConfigPath = (0,
|
|
64559
|
-
if ((0,
|
|
64700
|
+
const hooksConfigPath = (0, import_path36.join)(platformDir, pattern.hooksConfigFile);
|
|
64701
|
+
if ((0, import_fs38.existsSync)(hooksConfigPath)) {
|
|
64560
64702
|
configs.push({
|
|
64561
64703
|
platform: platform5,
|
|
64562
64704
|
type: "hooks",
|
|
64563
64705
|
name: pattern.hooksConfigFile,
|
|
64564
64706
|
path: hooksConfigPath,
|
|
64565
|
-
relativePath: (0,
|
|
64566
|
-
sizeBytes: (0,
|
|
64707
|
+
relativePath: (0, import_path36.relative)(rootDir, hooksConfigPath),
|
|
64708
|
+
sizeBytes: (0, import_fs38.statSync)(hooksConfigPath).size
|
|
64567
64709
|
});
|
|
64568
64710
|
}
|
|
64569
64711
|
}
|
|
64570
64712
|
if (pattern.agentsDir) {
|
|
64571
|
-
const agentsDir = (0,
|
|
64572
|
-
if ((0,
|
|
64713
|
+
const agentsDir = (0, import_path36.join)(platformDir, pattern.agentsDir);
|
|
64714
|
+
if ((0, import_fs38.existsSync)(agentsDir) && (0, import_fs38.statSync)(agentsDir).isDirectory()) {
|
|
64573
64715
|
scanDir(agentsDir, rootDir, platform5, "agents", [".md", ".toml", ".agent.md"], configs);
|
|
64574
64716
|
}
|
|
64575
64717
|
}
|
|
64576
64718
|
if (pattern.skillsDir) {
|
|
64577
|
-
const skillsDir = (0,
|
|
64578
|
-
if ((0,
|
|
64719
|
+
const skillsDir = (0, import_path36.join)(platformDir, pattern.skillsDir);
|
|
64720
|
+
if ((0, import_fs38.existsSync)(skillsDir) && (0, import_fs38.statSync)(skillsDir).isDirectory()) {
|
|
64579
64721
|
scanDir(skillsDir, rootDir, platform5, "skills", [".md"], configs);
|
|
64580
64722
|
}
|
|
64581
64723
|
}
|
|
64582
64724
|
if (pattern.policiesDir) {
|
|
64583
|
-
const policiesDir = (0,
|
|
64584
|
-
if ((0,
|
|
64725
|
+
const policiesDir = (0, import_path36.join)(platformDir, pattern.policiesDir);
|
|
64726
|
+
if ((0, import_fs38.existsSync)(policiesDir) && (0, import_fs38.statSync)(policiesDir).isDirectory()) {
|
|
64585
64727
|
scanDir(policiesDir, rootDir, platform5, "policies", [".toml", ".md"], configs);
|
|
64586
64728
|
}
|
|
64587
64729
|
}
|
|
64588
64730
|
if (pattern.workflowsDir) {
|
|
64589
|
-
const workflowsDir = (0,
|
|
64590
|
-
if ((0,
|
|
64731
|
+
const workflowsDir = (0, import_path36.join)(platformDir, pattern.workflowsDir);
|
|
64732
|
+
if ((0, import_fs38.existsSync)(workflowsDir) && (0, import_fs38.statSync)(workflowsDir).isDirectory()) {
|
|
64591
64733
|
scanDir(workflowsDir, rootDir, platform5, "workflows", [".md"], configs);
|
|
64592
64734
|
}
|
|
64593
64735
|
}
|
|
64594
64736
|
if (pattern.promptsDir) {
|
|
64595
|
-
const promptsDir = (0,
|
|
64596
|
-
if ((0,
|
|
64737
|
+
const promptsDir = (0, import_path36.join)(platformDir, pattern.promptsDir);
|
|
64738
|
+
if ((0, import_fs38.existsSync)(promptsDir) && (0, import_fs38.statSync)(promptsDir).isDirectory()) {
|
|
64597
64739
|
scanDir(promptsDir, rootDir, platform5, "prompts", [".prompt.md", ".md"], configs);
|
|
64598
64740
|
}
|
|
64599
64741
|
}
|
|
@@ -64612,59 +64754,59 @@ function scanPlatform(rootDir, pattern) {
|
|
|
64612
64754
|
for (const { key, type } of rootInstructionFiles) {
|
|
64613
64755
|
const fileName = pattern[key];
|
|
64614
64756
|
if (fileName) {
|
|
64615
|
-
const rootPath = (0,
|
|
64616
|
-
const platformPath = (0,
|
|
64617
|
-
if ((0,
|
|
64757
|
+
const rootPath = (0, import_path36.join)(rootDir, fileName);
|
|
64758
|
+
const platformPath = (0, import_path36.join)(platformDir, fileName);
|
|
64759
|
+
if ((0, import_fs38.existsSync)(rootPath)) {
|
|
64618
64760
|
configs.push({
|
|
64619
64761
|
platform: platform5,
|
|
64620
64762
|
type,
|
|
64621
64763
|
name: fileName,
|
|
64622
64764
|
path: rootPath,
|
|
64623
|
-
relativePath: (0,
|
|
64624
|
-
sizeBytes: (0,
|
|
64765
|
+
relativePath: (0, import_path36.relative)(rootDir, rootPath),
|
|
64766
|
+
sizeBytes: (0, import_fs38.statSync)(rootPath).size
|
|
64625
64767
|
});
|
|
64626
|
-
} else if ((0,
|
|
64768
|
+
} else if ((0, import_fs38.existsSync)(platformPath) && platformPath !== rootPath) {
|
|
64627
64769
|
configs.push({
|
|
64628
64770
|
platform: platform5,
|
|
64629
64771
|
type,
|
|
64630
64772
|
name: fileName,
|
|
64631
64773
|
path: platformPath,
|
|
64632
|
-
relativePath: (0,
|
|
64633
|
-
sizeBytes: (0,
|
|
64774
|
+
relativePath: (0, import_path36.relative)(rootDir, platformPath),
|
|
64775
|
+
sizeBytes: (0, import_fs38.statSync)(platformPath).size
|
|
64634
64776
|
});
|
|
64635
64777
|
}
|
|
64636
64778
|
}
|
|
64637
64779
|
}
|
|
64638
64780
|
if (pattern.mcpFile) {
|
|
64639
|
-
const mcpPath = (0,
|
|
64640
|
-
if ((0,
|
|
64781
|
+
const mcpPath = (0, import_path36.join)(rootDir, pattern.mcpFile);
|
|
64782
|
+
if ((0, import_fs38.existsSync)(mcpPath)) {
|
|
64641
64783
|
configs.push({
|
|
64642
64784
|
platform: platform5,
|
|
64643
64785
|
type: "mcp",
|
|
64644
64786
|
name: pattern.mcpFile,
|
|
64645
64787
|
path: mcpPath,
|
|
64646
|
-
relativePath: (0,
|
|
64647
|
-
sizeBytes: (0,
|
|
64788
|
+
relativePath: (0, import_path36.relative)(rootDir, mcpPath),
|
|
64789
|
+
sizeBytes: (0, import_fs38.statSync)(mcpPath).size
|
|
64648
64790
|
});
|
|
64649
64791
|
}
|
|
64650
64792
|
}
|
|
64651
64793
|
if (pattern.memoryDir) {
|
|
64652
|
-
const memDir = (0,
|
|
64653
|
-
if ((0,
|
|
64794
|
+
const memDir = (0, import_path36.join)(platformDir, pattern.memoryDir);
|
|
64795
|
+
if ((0, import_fs38.existsSync)(memDir) && (0, import_fs38.statSync)(memDir).isDirectory()) {
|
|
64654
64796
|
const exts = pattern.memoryExtensions || [".md"];
|
|
64655
64797
|
scanDir(memDir, rootDir, platform5, "memory", exts, configs);
|
|
64656
64798
|
}
|
|
64657
64799
|
}
|
|
64658
64800
|
if (pattern.cliConfigFile) {
|
|
64659
|
-
const cliPath = (0,
|
|
64660
|
-
if ((0,
|
|
64801
|
+
const cliPath = (0, import_path36.join)(platformDir, pattern.cliConfigFile);
|
|
64802
|
+
if ((0, import_fs38.existsSync)(cliPath)) {
|
|
64661
64803
|
configs.push({
|
|
64662
64804
|
platform: platform5,
|
|
64663
64805
|
type: "settings",
|
|
64664
64806
|
name: pattern.cliConfigFile,
|
|
64665
64807
|
path: cliPath,
|
|
64666
|
-
relativePath: (0,
|
|
64667
|
-
sizeBytes: (0,
|
|
64808
|
+
relativePath: (0, import_path36.relative)(rootDir, cliPath),
|
|
64809
|
+
sizeBytes: (0, import_fs38.statSync)(cliPath).size
|
|
64668
64810
|
});
|
|
64669
64811
|
}
|
|
64670
64812
|
}
|
|
@@ -64672,9 +64814,9 @@ function scanPlatform(rootDir, pattern) {
|
|
|
64672
64814
|
}
|
|
64673
64815
|
function scanDir(dir, rootDir, platform5, type, extensions, configs) {
|
|
64674
64816
|
try {
|
|
64675
|
-
const entries = (0,
|
|
64817
|
+
const entries = (0, import_fs38.readdirSync)(dir, { withFileTypes: true });
|
|
64676
64818
|
for (const entry of entries) {
|
|
64677
|
-
const fullPath = (0,
|
|
64819
|
+
const fullPath = (0, import_path36.join)(dir, entry.name);
|
|
64678
64820
|
if (entry.isDirectory()) {
|
|
64679
64821
|
scanDir(fullPath, rootDir, platform5, type, extensions, configs);
|
|
64680
64822
|
} else if (entry.isFile()) {
|
|
@@ -64685,8 +64827,8 @@ function scanDir(dir, rootDir, platform5, type, extensions, configs) {
|
|
|
64685
64827
|
type,
|
|
64686
64828
|
name: entry.name,
|
|
64687
64829
|
path: fullPath,
|
|
64688
|
-
relativePath: (0,
|
|
64689
|
-
sizeBytes: (0,
|
|
64830
|
+
relativePath: (0, import_path36.relative)(rootDir, fullPath),
|
|
64831
|
+
sizeBytes: (0, import_fs38.statSync)(fullPath).size
|
|
64690
64832
|
});
|
|
64691
64833
|
}
|
|
64692
64834
|
}
|
|
@@ -64703,7 +64845,7 @@ function createScanCommand() {
|
|
|
64703
64845
|
const command = new Command("scan");
|
|
64704
64846
|
command.description("Scan local directory for AI agent configurations (no auth required)").option("--path <path>", "Directory to scan (default: current directory or project root)").option("-p, --platform <platform>", `Filter by platform (${ALL_PLATFORM_IDS.join(", ")})`).option("--format <format>", "Output format: table (default) or json", "table").option("-r, --recursive", "Scan subdirectories for additional projects").option("--include-global", "Include global/home-directory memory locations").action(async (options) => {
|
|
64705
64847
|
const targetDir = options.path ? options.path : findProjectRoot(process.cwd());
|
|
64706
|
-
if (!(0,
|
|
64848
|
+
if (!(0, import_fs38.existsSync)(targetDir)) {
|
|
64707
64849
|
console.error(source_default.red(`Directory not found: ${targetDir}`));
|
|
64708
64850
|
process.exit(1);
|
|
64709
64851
|
}
|
|
@@ -64734,12 +64876,12 @@ function createScanCommand() {
|
|
|
64734
64876
|
}
|
|
64735
64877
|
}
|
|
64736
64878
|
if (options.includeGlobal) {
|
|
64737
|
-
const home = (0,
|
|
64879
|
+
const home = (0, import_os24.homedir)();
|
|
64738
64880
|
for (const loc of GLOBAL_MEMORY_LOCATIONS) {
|
|
64739
64881
|
if (platformFilter && loc.platform !== platformFilter) continue;
|
|
64740
64882
|
for (const relPath of loc.paths) {
|
|
64741
|
-
const globalDir = (0,
|
|
64742
|
-
if (!(0,
|
|
64883
|
+
const globalDir = (0, import_path36.join)(home, relPath);
|
|
64884
|
+
if (!(0, import_fs38.existsSync)(globalDir) || !(0, import_fs38.statSync)(globalDir).isDirectory()) continue;
|
|
64743
64885
|
const globalConfigs = [];
|
|
64744
64886
|
scanDir(globalDir, home, loc.platform, "memory", loc.extensions, globalConfigs);
|
|
64745
64887
|
if (globalConfigs.length > 0) {
|
|
@@ -64815,15 +64957,15 @@ function createScanCommand() {
|
|
|
64815
64957
|
});
|
|
64816
64958
|
return command;
|
|
64817
64959
|
}
|
|
64818
|
-
var
|
|
64960
|
+
var import_fs38, import_path36, import_os24, GLOBAL_MEMORY_LOCATIONS, PLATFORM_LABELS, PLATFORM_COLORS;
|
|
64819
64961
|
var init_scan = __esm({
|
|
64820
64962
|
"src/commands/scan.ts"() {
|
|
64821
64963
|
"use strict";
|
|
64822
64964
|
init_esm();
|
|
64823
64965
|
init_source();
|
|
64824
|
-
|
|
64825
|
-
|
|
64826
|
-
|
|
64966
|
+
import_fs38 = require("fs");
|
|
64967
|
+
import_path36 = require("path");
|
|
64968
|
+
import_os24 = require("os");
|
|
64827
64969
|
init_dist2();
|
|
64828
64970
|
init_project_detection();
|
|
64829
64971
|
GLOBAL_MEMORY_LOCATIONS = [
|
|
@@ -65495,8 +65637,8 @@ function createSandboxCommand() {
|
|
|
65495
65637
|
return sandboxCmd;
|
|
65496
65638
|
}
|
|
65497
65639
|
async function validateConfigFile(sandbox, options) {
|
|
65498
|
-
const configPath =
|
|
65499
|
-
const fileName =
|
|
65640
|
+
const configPath = import_path37.default.resolve(options.config);
|
|
65641
|
+
const fileName = import_path37.default.basename(configPath);
|
|
65500
65642
|
const spinner = ora(`Loading configuration: ${fileName}`).start();
|
|
65501
65643
|
try {
|
|
65502
65644
|
const configContent = await import_promises8.default.readFile(configPath, "utf-8");
|
|
@@ -65607,11 +65749,11 @@ async function startInteractiveSession(sandbox) {
|
|
|
65607
65749
|
rl.on("close", () => {
|
|
65608
65750
|
console.log(source_default.gray("\nEnding interactive session..."));
|
|
65609
65751
|
});
|
|
65610
|
-
return new Promise((
|
|
65611
|
-
rl.on("close",
|
|
65752
|
+
return new Promise((resolve11) => {
|
|
65753
|
+
rl.on("close", resolve11);
|
|
65612
65754
|
});
|
|
65613
65755
|
}
|
|
65614
|
-
var import_promises8,
|
|
65756
|
+
var import_promises8, import_path37;
|
|
65615
65757
|
var init_sandbox = __esm({
|
|
65616
65758
|
"src/commands/sandbox.ts"() {
|
|
65617
65759
|
"use strict";
|
|
@@ -65620,7 +65762,7 @@ var init_sandbox = __esm({
|
|
|
65620
65762
|
init_ora();
|
|
65621
65763
|
init_e2b_sandbox();
|
|
65622
65764
|
import_promises8 = __toESM(require("fs/promises"), 1);
|
|
65623
|
-
|
|
65765
|
+
import_path37 = __toESM(require("path"), 1);
|
|
65624
65766
|
}
|
|
65625
65767
|
});
|
|
65626
65768
|
|
|
@@ -65629,7 +65771,7 @@ function isTestFile(filename) {
|
|
|
65629
65771
|
return /\.(test|spec)\.(ts|tsx|js|jsx)$/.test(filename);
|
|
65630
65772
|
}
|
|
65631
65773
|
function isImplFile(filename) {
|
|
65632
|
-
const ext = (0,
|
|
65774
|
+
const ext = (0, import_path38.extname)(filename);
|
|
65633
65775
|
if (!IMPL_EXTENSIONS.has(ext)) return false;
|
|
65634
65776
|
if (isTestFile(filename)) return false;
|
|
65635
65777
|
if (IGNORE_FILES.has(filename)) return false;
|
|
@@ -65644,16 +65786,16 @@ function scanDirectory(dir, maxDepth = 6) {
|
|
|
65644
65786
|
if (depth > maxDepth) return;
|
|
65645
65787
|
let entries;
|
|
65646
65788
|
try {
|
|
65647
|
-
entries = (0,
|
|
65789
|
+
entries = (0, import_fs39.readdirSync)(currentDir);
|
|
65648
65790
|
} catch {
|
|
65649
65791
|
return;
|
|
65650
65792
|
}
|
|
65651
65793
|
for (const entry of entries) {
|
|
65652
65794
|
if (IGNORE_DIRS.has(entry)) continue;
|
|
65653
|
-
const fullPath = (0,
|
|
65795
|
+
const fullPath = (0, import_path38.join)(currentDir, entry);
|
|
65654
65796
|
let stat5;
|
|
65655
65797
|
try {
|
|
65656
|
-
stat5 = (0,
|
|
65798
|
+
stat5 = (0, import_fs39.statSync)(fullPath);
|
|
65657
65799
|
} catch {
|
|
65658
65800
|
continue;
|
|
65659
65801
|
}
|
|
@@ -65663,7 +65805,7 @@ function scanDirectory(dir, maxDepth = 6) {
|
|
|
65663
65805
|
}
|
|
65664
65806
|
walk(fullPath, depth + 1);
|
|
65665
65807
|
} else if (stat5.isFile()) {
|
|
65666
|
-
const relPath = (0,
|
|
65808
|
+
const relPath = (0, import_path38.relative)(dir, fullPath);
|
|
65667
65809
|
if (isTestFile(entry)) {
|
|
65668
65810
|
testFiles.push(relPath);
|
|
65669
65811
|
} else if (isImplFile(entry)) {
|
|
@@ -65683,15 +65825,15 @@ function findSpecFiles(dir) {
|
|
|
65683
65825
|
if (depth > 4) return;
|
|
65684
65826
|
let entries;
|
|
65685
65827
|
try {
|
|
65686
|
-
entries = (0,
|
|
65828
|
+
entries = (0, import_fs39.readdirSync)(currentDir);
|
|
65687
65829
|
} catch {
|
|
65688
65830
|
return;
|
|
65689
65831
|
}
|
|
65690
65832
|
for (const entry of entries) {
|
|
65691
|
-
const fullPath = (0,
|
|
65833
|
+
const fullPath = (0, import_path38.join)(currentDir, entry);
|
|
65692
65834
|
let stat5;
|
|
65693
65835
|
try {
|
|
65694
|
-
stat5 = (0,
|
|
65836
|
+
stat5 = (0, import_fs39.statSync)(fullPath);
|
|
65695
65837
|
} catch {
|
|
65696
65838
|
continue;
|
|
65697
65839
|
}
|
|
@@ -65707,10 +65849,10 @@ function findSpecFiles(dir) {
|
|
|
65707
65849
|
}
|
|
65708
65850
|
function findImplFilesWithoutTests(implFiles, testFiles) {
|
|
65709
65851
|
const testBasenames = new Set(
|
|
65710
|
-
testFiles.map((f) => (0,
|
|
65852
|
+
testFiles.map((f) => (0, import_path38.basename)(f).replace(/\.(test|spec)\.(ts|tsx|js|jsx)$/, ""))
|
|
65711
65853
|
);
|
|
65712
65854
|
return implFiles.filter((f) => {
|
|
65713
|
-
const base = (0,
|
|
65855
|
+
const base = (0, import_path38.basename)(f).replace(/\.(ts|tsx|js|jsx)$/, "");
|
|
65714
65856
|
return !testBasenames.has(base);
|
|
65715
65857
|
});
|
|
65716
65858
|
}
|
|
@@ -65740,8 +65882,8 @@ function runChecks(basePath) {
|
|
|
65740
65882
|
const weight2 = 25;
|
|
65741
65883
|
maxScore += weight2;
|
|
65742
65884
|
const hasSpecs = specFiles.length > 0;
|
|
65743
|
-
const hasClaudeDir = (0,
|
|
65744
|
-
const hasSpecsDir = (0,
|
|
65885
|
+
const hasClaudeDir = (0, import_fs39.existsSync)((0, import_path38.join)(basePath, ".claude"));
|
|
65886
|
+
const hasSpecsDir = (0, import_fs39.existsSync)((0, import_path38.join)(basePath, "specs"));
|
|
65745
65887
|
let specScore = 0;
|
|
65746
65888
|
if (hasSpecs) specScore += 15;
|
|
65747
65889
|
if (hasClaudeDir) specScore += 5;
|
|
@@ -65760,8 +65902,8 @@ function runChecks(basePath) {
|
|
|
65760
65902
|
}
|
|
65761
65903
|
const weight3 = 15;
|
|
65762
65904
|
maxScore += weight3;
|
|
65763
|
-
const hasClaudeMd = (0,
|
|
65764
|
-
const hasClaudeSettings = (0,
|
|
65905
|
+
const hasClaudeMd = (0, import_fs39.existsSync)((0, import_path38.join)(basePath, "CLAUDE.md"));
|
|
65906
|
+
const hasClaudeSettings = (0, import_fs39.existsSync)((0, import_path38.join)(basePath, ".claude", "settings.json"));
|
|
65765
65907
|
let claudeScore = 0;
|
|
65766
65908
|
if (hasClaudeMd) claudeScore += 10;
|
|
65767
65909
|
if (hasClaudeSettings) claudeScore += 5;
|
|
@@ -65779,9 +65921,9 @@ function runChecks(basePath) {
|
|
|
65779
65921
|
}
|
|
65780
65922
|
const weight4 = 15;
|
|
65781
65923
|
maxScore += weight4;
|
|
65782
|
-
const hasPackageJson = (0,
|
|
65783
|
-
const hasReadme = (0,
|
|
65784
|
-
const hasTsConfig = (0,
|
|
65924
|
+
const hasPackageJson = (0, import_fs39.existsSync)((0, import_path38.join)(basePath, "package.json"));
|
|
65925
|
+
const hasReadme = (0, import_fs39.existsSync)((0, import_path38.join)(basePath, "README.md"));
|
|
65926
|
+
const hasTsConfig = (0, import_fs39.existsSync)((0, import_path38.join)(basePath, "tsconfig.json"));
|
|
65785
65927
|
let structureScore = 0;
|
|
65786
65928
|
if (hasPackageJson) structureScore += 5;
|
|
65787
65929
|
if (hasReadme) structureScore += 5;
|
|
@@ -65801,9 +65943,9 @@ function runChecks(basePath) {
|
|
|
65801
65943
|
});
|
|
65802
65944
|
const weight5 = 15;
|
|
65803
65945
|
maxScore += weight5;
|
|
65804
|
-
const hasGitDir = (0,
|
|
65805
|
-
const hasGithubDir = (0,
|
|
65806
|
-
const hasWorkflows = (0,
|
|
65946
|
+
const hasGitDir = (0, import_fs39.existsSync)((0, import_path38.join)(basePath, ".git"));
|
|
65947
|
+
const hasGithubDir = (0, import_fs39.existsSync)((0, import_path38.join)(basePath, ".github"));
|
|
65948
|
+
const hasWorkflows = (0, import_fs39.existsSync)((0, import_path38.join)(basePath, ".github", "workflows"));
|
|
65807
65949
|
let gitScore = 0;
|
|
65808
65950
|
if (hasGitDir) gitScore += 5;
|
|
65809
65951
|
if (hasGithubDir) gitScore += 5;
|
|
@@ -66142,8 +66284,8 @@ function createSdlcCommand() {
|
|
|
66142
66284
|
spinner.start("Scanning git history and local artifacts...");
|
|
66143
66285
|
const basePath = process.cwd();
|
|
66144
66286
|
const SDLC_PHASES_ORDERED = ["specify", "design", "test", "implement", "deploy-verify", "review", "merge"];
|
|
66145
|
-
const hasSpec = (0,
|
|
66146
|
-
const hasPlan = (0,
|
|
66287
|
+
const hasSpec = (0, import_fs39.existsSync)((0, import_path38.join)(basePath, "spec.md")) || (0, import_fs39.existsSync)((0, import_path38.join)(basePath, "specs")) || (0, import_fs39.existsSync)((0, import_path38.join)(basePath, ".claude", "spec.md"));
|
|
66288
|
+
const hasPlan = (0, import_fs39.existsSync)((0, import_path38.join)(basePath, "plan.md")) || (0, import_fs39.existsSync)((0, import_path38.join)(basePath, ".claude", "plan.md")) || (0, import_fs39.existsSync)((0, import_path38.join)(basePath, "tasks.md"));
|
|
66147
66289
|
const scanResult = scanDirectory(basePath);
|
|
66148
66290
|
const hasTests = scanResult.testFiles.length > 0;
|
|
66149
66291
|
const hasImpl = scanResult.implFiles.length > 0;
|
|
@@ -66286,15 +66428,15 @@ function createSdlcCommand() {
|
|
|
66286
66428
|
});
|
|
66287
66429
|
return cmd;
|
|
66288
66430
|
}
|
|
66289
|
-
var
|
|
66431
|
+
var import_fs39, import_path38, import_child_process11, IMPL_EXTENSIONS, IGNORE_DIRS, IGNORE_FILES;
|
|
66290
66432
|
var init_sdlc = __esm({
|
|
66291
66433
|
"src/commands/sdlc.ts"() {
|
|
66292
66434
|
"use strict";
|
|
66293
66435
|
init_esm();
|
|
66294
66436
|
init_source();
|
|
66295
66437
|
init_ora();
|
|
66296
|
-
|
|
66297
|
-
|
|
66438
|
+
import_fs39 = require("fs");
|
|
66439
|
+
import_path38 = require("path");
|
|
66298
66440
|
import_child_process11 = require("child_process");
|
|
66299
66441
|
init_config_manager();
|
|
66300
66442
|
IMPL_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".jsx"]);
|
|
@@ -66413,10 +66555,10 @@ var init_security = __esm({
|
|
|
66413
66555
|
|
|
66414
66556
|
// src/commands/status.ts
|
|
66415
66557
|
function readTermsAcceptance() {
|
|
66416
|
-
const configFile = (0,
|
|
66558
|
+
const configFile = (0, import_path39.join)((0, import_os25.homedir)(), ".gal", "config.json");
|
|
66417
66559
|
try {
|
|
66418
|
-
if ((0,
|
|
66419
|
-
const raw = JSON.parse((0,
|
|
66560
|
+
if ((0, import_fs40.existsSync)(configFile)) {
|
|
66561
|
+
const raw = JSON.parse((0, import_fs40.readFileSync)(configFile, "utf-8"));
|
|
66420
66562
|
if (typeof raw.termsAcceptedAt === "string" && raw.termsAcceptedAt.length > 0) {
|
|
66421
66563
|
return { accepted: true, acceptedAt: raw.termsAcceptedAt };
|
|
66422
66564
|
}
|
|
@@ -66619,7 +66761,7 @@ function displayStatusJson(result, health) {
|
|
|
66619
66761
|
}
|
|
66620
66762
|
function isRateLimited(projectId) {
|
|
66621
66763
|
try {
|
|
66622
|
-
const raw = (0,
|
|
66764
|
+
const raw = (0, import_fs40.readFileSync)(DRIFT_REPORT_CACHE_PATH, "utf-8");
|
|
66623
66765
|
const cache = JSON.parse(raw);
|
|
66624
66766
|
const lastReport = cache[projectId];
|
|
66625
66767
|
if (lastReport && Date.now() - lastReport < RATE_LIMIT_MS) {
|
|
@@ -66633,13 +66775,13 @@ function recordReport(projectId) {
|
|
|
66633
66775
|
try {
|
|
66634
66776
|
let cache = {};
|
|
66635
66777
|
try {
|
|
66636
|
-
const raw = (0,
|
|
66778
|
+
const raw = (0, import_fs40.readFileSync)(DRIFT_REPORT_CACHE_PATH, "utf-8");
|
|
66637
66779
|
cache = JSON.parse(raw);
|
|
66638
66780
|
} catch {
|
|
66639
66781
|
}
|
|
66640
66782
|
cache[projectId] = Date.now();
|
|
66641
|
-
(0,
|
|
66642
|
-
(0,
|
|
66783
|
+
(0, import_fs40.mkdirSync)((0, import_path39.join)((0, import_os25.homedir)(), ".gal"), { recursive: true });
|
|
66784
|
+
(0, import_fs40.writeFileSync)(DRIFT_REPORT_CACHE_PATH, JSON.stringify(cache));
|
|
66643
66785
|
} catch {
|
|
66644
66786
|
}
|
|
66645
66787
|
}
|
|
@@ -66747,16 +66889,16 @@ function createStatusCommand3() {
|
|
|
66747
66889
|
});
|
|
66748
66890
|
return command;
|
|
66749
66891
|
}
|
|
66750
|
-
var
|
|
66892
|
+
var import_path39, import_os25, import_fs40, cliVersion6, defaultApiUrl16, PLATFORM_LABELS2, RATE_LIMIT_MS, DRIFT_REPORT_CACHE_PATH;
|
|
66751
66893
|
var init_status = __esm({
|
|
66752
66894
|
"src/commands/status.ts"() {
|
|
66753
66895
|
"use strict";
|
|
66754
66896
|
init_esm();
|
|
66755
66897
|
init_source();
|
|
66756
66898
|
init_ora();
|
|
66757
|
-
|
|
66758
|
-
|
|
66759
|
-
|
|
66899
|
+
import_path39 = require("path");
|
|
66900
|
+
import_os25 = require("os");
|
|
66901
|
+
import_fs40 = require("fs");
|
|
66760
66902
|
init_gal_config_service();
|
|
66761
66903
|
init_config_manager();
|
|
66762
66904
|
init_CoreServiceProvider();
|
|
@@ -66773,7 +66915,7 @@ var init_status = __esm({
|
|
|
66773
66915
|
])
|
|
66774
66916
|
);
|
|
66775
66917
|
RATE_LIMIT_MS = 5 * 60 * 1e3;
|
|
66776
|
-
DRIFT_REPORT_CACHE_PATH = (0,
|
|
66918
|
+
DRIFT_REPORT_CACHE_PATH = (0, import_path39.join)((0, import_os25.homedir)(), ".gal", "drift-report-cache.json");
|
|
66777
66919
|
}
|
|
66778
66920
|
});
|
|
66779
66921
|
|
|
@@ -68087,7 +68229,7 @@ var init_triggers = __esm({
|
|
|
68087
68229
|
* @returns A promise that resolves after the delay
|
|
68088
68230
|
*/
|
|
68089
68231
|
delay(ms) {
|
|
68090
|
-
return new Promise((
|
|
68232
|
+
return new Promise((resolve11) => setTimeout(resolve11, ms));
|
|
68091
68233
|
}
|
|
68092
68234
|
};
|
|
68093
68235
|
defaultRegistry = null;
|
|
@@ -68101,13 +68243,13 @@ function getGitHookManager() {
|
|
|
68101
68243
|
}
|
|
68102
68244
|
return defaultManager;
|
|
68103
68245
|
}
|
|
68104
|
-
var import_child_process12,
|
|
68246
|
+
var import_child_process12, import_fs41, import_path40, DEFAULT_GIT_HOOK_CONFIG, GitHookManager, defaultManager;
|
|
68105
68247
|
var init_git_hooks = __esm({
|
|
68106
68248
|
"src/triggers/git-hooks.ts"() {
|
|
68107
68249
|
"use strict";
|
|
68108
68250
|
import_child_process12 = require("child_process");
|
|
68109
|
-
|
|
68110
|
-
|
|
68251
|
+
import_fs41 = require("fs");
|
|
68252
|
+
import_path40 = require("path");
|
|
68111
68253
|
init_source();
|
|
68112
68254
|
init_triggers();
|
|
68113
68255
|
DEFAULT_GIT_HOOK_CONFIG = {
|
|
@@ -68150,12 +68292,12 @@ var init_git_hooks = __esm({
|
|
|
68150
68292
|
if (this.gitDir) return this.gitDir;
|
|
68151
68293
|
let currentPath = startPath;
|
|
68152
68294
|
while (currentPath !== "/") {
|
|
68153
|
-
const gitPath = (0,
|
|
68154
|
-
if ((0,
|
|
68295
|
+
const gitPath = (0, import_path40.join)(currentPath, ".git");
|
|
68296
|
+
if ((0, import_fs41.existsSync)(gitPath)) {
|
|
68155
68297
|
this.gitDir = gitPath;
|
|
68156
68298
|
return gitPath;
|
|
68157
68299
|
}
|
|
68158
|
-
currentPath = (0,
|
|
68300
|
+
currentPath = (0, import_path40.dirname)(currentPath);
|
|
68159
68301
|
}
|
|
68160
68302
|
return null;
|
|
68161
68303
|
}
|
|
@@ -68177,29 +68319,29 @@ var init_git_hooks = __esm({
|
|
|
68177
68319
|
]
|
|
68178
68320
|
};
|
|
68179
68321
|
}
|
|
68180
|
-
const hooksDir = (0,
|
|
68181
|
-
if (!(0,
|
|
68182
|
-
(0,
|
|
68322
|
+
const hooksDir = (0, import_path40.join)(gitDir, "hooks");
|
|
68323
|
+
if (!(0, import_fs41.existsSync)(hooksDir)) {
|
|
68324
|
+
(0, import_fs41.mkdirSync)(hooksDir, { recursive: true });
|
|
68183
68325
|
}
|
|
68184
68326
|
const installed = [];
|
|
68185
68327
|
const skipped = [];
|
|
68186
68328
|
const warnings = [];
|
|
68187
68329
|
for (const hookType of this.config.hooks) {
|
|
68188
|
-
const hookPath = (0,
|
|
68330
|
+
const hookPath = (0, import_path40.join)(hooksDir, hookType);
|
|
68189
68331
|
const hookScript = this.generateHookScript(hookType);
|
|
68190
|
-
if ((0,
|
|
68191
|
-
const existing = (0,
|
|
68332
|
+
if ((0, import_fs41.existsSync)(hookPath)) {
|
|
68333
|
+
const existing = (0, import_fs41.readFileSync)(hookPath, "utf-8");
|
|
68192
68334
|
if (existing.includes("GAL_HOOK_MARKER")) {
|
|
68193
|
-
(0,
|
|
68194
|
-
(0,
|
|
68335
|
+
(0, import_fs41.writeFileSync)(hookPath, hookScript);
|
|
68336
|
+
(0, import_fs41.chmodSync)(hookPath, "755");
|
|
68195
68337
|
installed.push(hookType);
|
|
68196
68338
|
} else {
|
|
68197
68339
|
console.log(source_default.yellow(`Skipping ${hookType}: existing hook found`));
|
|
68198
68340
|
skipped.push(hookType);
|
|
68199
68341
|
}
|
|
68200
68342
|
} else {
|
|
68201
|
-
(0,
|
|
68202
|
-
(0,
|
|
68343
|
+
(0, import_fs41.writeFileSync)(hookPath, hookScript);
|
|
68344
|
+
(0, import_fs41.chmodSync)(hookPath, "755");
|
|
68203
68345
|
installed.push(hookType);
|
|
68204
68346
|
}
|
|
68205
68347
|
}
|
|
@@ -68216,12 +68358,12 @@ var init_git_hooks = __esm({
|
|
|
68216
68358
|
if (!gitDir) {
|
|
68217
68359
|
return [];
|
|
68218
68360
|
}
|
|
68219
|
-
const hooksDir = (0,
|
|
68361
|
+
const hooksDir = (0, import_path40.join)(gitDir, "hooks");
|
|
68220
68362
|
const removed = [];
|
|
68221
68363
|
for (const hookType of this.config.hooks) {
|
|
68222
|
-
const hookPath = (0,
|
|
68223
|
-
if ((0,
|
|
68224
|
-
const content = (0,
|
|
68364
|
+
const hookPath = (0, import_path40.join)(hooksDir, hookType);
|
|
68365
|
+
if ((0, import_fs41.existsSync)(hookPath)) {
|
|
68366
|
+
const content = (0, import_fs41.readFileSync)(hookPath, "utf-8");
|
|
68225
68367
|
if (content.includes("GAL_HOOK_MARKER")) {
|
|
68226
68368
|
const { unlinkSync: unlinkSync8 } = require("fs");
|
|
68227
68369
|
unlinkSync8(hookPath);
|
|
@@ -68444,13 +68586,13 @@ exit 0
|
|
|
68444
68586
|
if (!gitDir) {
|
|
68445
68587
|
return { installed: [], missing: this.config.hooks };
|
|
68446
68588
|
}
|
|
68447
|
-
const hooksDir = (0,
|
|
68589
|
+
const hooksDir = (0, import_path40.join)(gitDir, "hooks");
|
|
68448
68590
|
const installed = [];
|
|
68449
68591
|
const missing = [];
|
|
68450
68592
|
for (const hookType of this.config.hooks) {
|
|
68451
|
-
const hookPath = (0,
|
|
68452
|
-
if ((0,
|
|
68453
|
-
const content = (0,
|
|
68593
|
+
const hookPath = (0, import_path40.join)(hooksDir, hookType);
|
|
68594
|
+
if ((0, import_fs41.existsSync)(hookPath)) {
|
|
68595
|
+
const content = (0, import_fs41.readFileSync)(hookPath, "utf-8");
|
|
68454
68596
|
if (content.includes("GAL_HOOK_MARKER")) {
|
|
68455
68597
|
installed.push(hookType);
|
|
68456
68598
|
} else {
|
|
@@ -68474,12 +68616,12 @@ function getFileWatcher() {
|
|
|
68474
68616
|
}
|
|
68475
68617
|
return defaultWatcher;
|
|
68476
68618
|
}
|
|
68477
|
-
var
|
|
68619
|
+
var import_fs42, import_path41, DEFAULT_FILE_WATCHER_CONFIG, AGENT_CONFIG_PATTERNS, FileWatcher, defaultWatcher;
|
|
68478
68620
|
var init_file_watcher = __esm({
|
|
68479
68621
|
"src/triggers/file-watcher.ts"() {
|
|
68480
68622
|
"use strict";
|
|
68481
|
-
|
|
68482
|
-
|
|
68623
|
+
import_fs42 = require("fs");
|
|
68624
|
+
import_path41 = require("path");
|
|
68483
68625
|
init_source();
|
|
68484
68626
|
init_triggers();
|
|
68485
68627
|
DEFAULT_FILE_WATCHER_CONFIG = {
|
|
@@ -68535,13 +68677,13 @@ var init_file_watcher = __esm({
|
|
|
68535
68677
|
const watching = [];
|
|
68536
68678
|
const notFound = [];
|
|
68537
68679
|
for (const watchPath of this.config.watchPaths) {
|
|
68538
|
-
const fullPath = (0,
|
|
68539
|
-
if (!(0,
|
|
68680
|
+
const fullPath = (0, import_path41.join)(basePath, watchPath);
|
|
68681
|
+
if (!(0, import_fs42.existsSync)(fullPath)) {
|
|
68540
68682
|
notFound.push(watchPath);
|
|
68541
68683
|
continue;
|
|
68542
68684
|
}
|
|
68543
68685
|
try {
|
|
68544
|
-
const watcher = (0,
|
|
68686
|
+
const watcher = (0, import_fs42.watch)(
|
|
68545
68687
|
fullPath,
|
|
68546
68688
|
{ recursive: this.config.recursive },
|
|
68547
68689
|
(eventType, filename) => {
|
|
@@ -68588,7 +68730,7 @@ var init_file_watcher = __esm({
|
|
|
68588
68730
|
* @returns True if the file matches any ignore pattern and should be skipped
|
|
68589
68731
|
*/
|
|
68590
68732
|
shouldIgnore(filename) {
|
|
68591
|
-
const name = (0,
|
|
68733
|
+
const name = (0, import_path41.basename)(filename);
|
|
68592
68734
|
for (const pattern of this.config.ignorePatterns) {
|
|
68593
68735
|
if (pattern.startsWith("*")) {
|
|
68594
68736
|
if (name.endsWith(pattern.slice(1))) {
|
|
@@ -68614,7 +68756,7 @@ var init_file_watcher = __esm({
|
|
|
68614
68756
|
* @param filename - The name of the file that changed
|
|
68615
68757
|
*/
|
|
68616
68758
|
handleFileEvent(eventType, watchPath, filename) {
|
|
68617
|
-
const fullPath = (0,
|
|
68759
|
+
const fullPath = (0, import_path41.join)(watchPath, filename);
|
|
68618
68760
|
const debounceKey = `${eventType}:${fullPath}`;
|
|
68619
68761
|
const existingTimer = this.debounceTimers.get(debounceKey);
|
|
68620
68762
|
if (existingTimer) {
|
|
@@ -68634,13 +68776,13 @@ var init_file_watcher = __esm({
|
|
|
68634
68776
|
* @param filename - The name of the file that changed
|
|
68635
68777
|
*/
|
|
68636
68778
|
async processFileEvent(eventType, watchPath, filename) {
|
|
68637
|
-
const fullPath = (0,
|
|
68779
|
+
const fullPath = (0, import_path41.join)(watchPath, filename);
|
|
68638
68780
|
let fsEventType;
|
|
68639
68781
|
let isDirectory = false;
|
|
68640
68782
|
let size;
|
|
68641
68783
|
try {
|
|
68642
|
-
if ((0,
|
|
68643
|
-
const stats = (0,
|
|
68784
|
+
if ((0, import_fs42.existsSync)(fullPath)) {
|
|
68785
|
+
const stats = (0, import_fs42.statSync)(fullPath);
|
|
68644
68786
|
isDirectory = stats.isDirectory();
|
|
68645
68787
|
size = stats.size;
|
|
68646
68788
|
fsEventType = eventType === "rename" ? "create" : "modify";
|
|
@@ -68785,12 +68927,12 @@ var init_file_watcher = __esm({
|
|
|
68785
68927
|
this.config.watchPaths.push(path8);
|
|
68786
68928
|
return true;
|
|
68787
68929
|
}
|
|
68788
|
-
const fullPath = (0,
|
|
68789
|
-
if (!(0,
|
|
68930
|
+
const fullPath = (0, import_path41.join)(basePath, path8);
|
|
68931
|
+
if (!(0, import_fs42.existsSync)(fullPath)) {
|
|
68790
68932
|
return false;
|
|
68791
68933
|
}
|
|
68792
68934
|
try {
|
|
68793
|
-
const watcher = (0,
|
|
68935
|
+
const watcher = (0, import_fs42.watch)(
|
|
68794
68936
|
fullPath,
|
|
68795
68937
|
{ recursive: this.config.recursive },
|
|
68796
68938
|
(eventType, filename) => {
|
|
@@ -69095,17 +69237,17 @@ async function confirm(message) {
|
|
|
69095
69237
|
input: process.stdin,
|
|
69096
69238
|
output: process.stdout
|
|
69097
69239
|
});
|
|
69098
|
-
return new Promise((
|
|
69240
|
+
return new Promise((resolve11) => {
|
|
69099
69241
|
rl.question(`${message} (y/N): `, (answer) => {
|
|
69100
69242
|
rl.close();
|
|
69101
|
-
|
|
69243
|
+
resolve11(answer.toLowerCase() === "y" || answer.toLowerCase() === "yes");
|
|
69102
69244
|
});
|
|
69103
69245
|
});
|
|
69104
69246
|
}
|
|
69105
69247
|
function isGalCreatedFile(filePath) {
|
|
69106
|
-
if (!(0,
|
|
69248
|
+
if (!(0, import_fs43.existsSync)(filePath)) return false;
|
|
69107
69249
|
try {
|
|
69108
|
-
const content = (0,
|
|
69250
|
+
const content = (0, import_fs43.readFileSync)(filePath, "utf-8");
|
|
69109
69251
|
const galMarkers = [
|
|
69110
69252
|
"GAL Config",
|
|
69111
69253
|
"GAL CLI",
|
|
@@ -69125,9 +69267,9 @@ function isGalCreatedFile(filePath) {
|
|
|
69125
69267
|
}
|
|
69126
69268
|
}
|
|
69127
69269
|
function isNpmInstalledFile(filePath) {
|
|
69128
|
-
if (!(0,
|
|
69270
|
+
if (!(0, import_fs43.existsSync)(filePath)) return false;
|
|
69129
69271
|
try {
|
|
69130
|
-
const content = (0,
|
|
69272
|
+
const content = (0, import_fs43.readFileSync)(filePath, "utf-8");
|
|
69131
69273
|
return content.includes("CURRENT_VERSION =") || content.includes("const CURRENT_VERSION");
|
|
69132
69274
|
} catch {
|
|
69133
69275
|
return false;
|
|
@@ -69144,15 +69286,15 @@ function detectFileSource(filePath) {
|
|
|
69144
69286
|
}
|
|
69145
69287
|
function detectUserLevelItems(options) {
|
|
69146
69288
|
const items = [];
|
|
69147
|
-
const claudeDir = (0,
|
|
69148
|
-
const claudeHooksDir = (0,
|
|
69149
|
-
const statusLinesDir = (0,
|
|
69289
|
+
const claudeDir = (0, import_path42.join)((0, import_os26.homedir)(), ".claude");
|
|
69290
|
+
const claudeHooksDir = (0, import_path42.join)(claudeDir, "hooks");
|
|
69291
|
+
const statusLinesDir = (0, import_path42.join)(claudeDir, "status_lines");
|
|
69150
69292
|
const includeNpm = options?.includeNpmInstalled ?? true;
|
|
69151
|
-
if ((0,
|
|
69152
|
-
const files = (0,
|
|
69293
|
+
if ((0, import_fs43.existsSync)(claudeHooksDir)) {
|
|
69294
|
+
const files = (0, import_fs43.readdirSync)(claudeHooksDir);
|
|
69153
69295
|
for (const file of files) {
|
|
69154
69296
|
if (file.startsWith("gal-")) {
|
|
69155
|
-
const filePath = (0,
|
|
69297
|
+
const filePath = (0, import_path42.join)(claudeHooksDir, file);
|
|
69156
69298
|
const source = detectFileSource(filePath);
|
|
69157
69299
|
if (!includeNpm && source === "npm") {
|
|
69158
69300
|
continue;
|
|
@@ -69167,11 +69309,11 @@ function detectUserLevelItems(options) {
|
|
|
69167
69309
|
}
|
|
69168
69310
|
}
|
|
69169
69311
|
}
|
|
69170
|
-
if ((0,
|
|
69171
|
-
const files = (0,
|
|
69312
|
+
if ((0, import_fs43.existsSync)(statusLinesDir)) {
|
|
69313
|
+
const files = (0, import_fs43.readdirSync)(statusLinesDir);
|
|
69172
69314
|
for (const file of files) {
|
|
69173
69315
|
if (file.startsWith("gal-")) {
|
|
69174
|
-
const filePath = (0,
|
|
69316
|
+
const filePath = (0, import_path42.join)(statusLinesDir, file);
|
|
69175
69317
|
const source = detectFileSource(filePath);
|
|
69176
69318
|
if (!includeNpm && source === "npm") {
|
|
69177
69319
|
continue;
|
|
@@ -69186,10 +69328,10 @@ function detectUserLevelItems(options) {
|
|
|
69186
69328
|
}
|
|
69187
69329
|
}
|
|
69188
69330
|
}
|
|
69189
|
-
const claudeSettingsPath = (0,
|
|
69190
|
-
if ((0,
|
|
69331
|
+
const claudeSettingsPath = (0, import_path42.join)(claudeDir, "settings.json");
|
|
69332
|
+
if ((0, import_fs43.existsSync)(claudeSettingsPath)) {
|
|
69191
69333
|
try {
|
|
69192
|
-
const settings = JSON.parse((0,
|
|
69334
|
+
const settings = JSON.parse((0, import_fs43.readFileSync)(claudeSettingsPath, "utf-8"));
|
|
69193
69335
|
if (settings.hooks?.SessionStart) {
|
|
69194
69336
|
const hasGalHooks = settings.hooks.SessionStart.some(
|
|
69195
69337
|
(entry) => entry.hooks?.some(
|
|
@@ -69236,14 +69378,14 @@ function detectUserLevelItems(options) {
|
|
|
69236
69378
|
} catch {
|
|
69237
69379
|
}
|
|
69238
69380
|
}
|
|
69239
|
-
const cursorDir = (0,
|
|
69240
|
-
const cursorHooksDir = (0,
|
|
69241
|
-
if ((0,
|
|
69242
|
-
const files = (0,
|
|
69381
|
+
const cursorDir = (0, import_path42.join)((0, import_os26.homedir)(), ".cursor");
|
|
69382
|
+
const cursorHooksDir = (0, import_path42.join)(cursorDir, "hooks");
|
|
69383
|
+
if ((0, import_fs43.existsSync)(cursorHooksDir)) {
|
|
69384
|
+
const files = (0, import_fs43.readdirSync)(cursorHooksDir);
|
|
69243
69385
|
for (const file of files) {
|
|
69244
69386
|
if (file.startsWith("gal-")) {
|
|
69245
69387
|
items.push({
|
|
69246
|
-
path: (0,
|
|
69388
|
+
path: (0, import_path42.join)(cursorHooksDir, file),
|
|
69247
69389
|
type: "file",
|
|
69248
69390
|
reason: "GAL hook file for Cursor IDE",
|
|
69249
69391
|
isGalOwned: true
|
|
@@ -69251,10 +69393,10 @@ function detectUserLevelItems(options) {
|
|
|
69251
69393
|
}
|
|
69252
69394
|
}
|
|
69253
69395
|
}
|
|
69254
|
-
const cursorHooksJsonPath = (0,
|
|
69255
|
-
if ((0,
|
|
69396
|
+
const cursorHooksJsonPath = (0, import_path42.join)(cursorDir, "hooks.json");
|
|
69397
|
+
if ((0, import_fs43.existsSync)(cursorHooksJsonPath)) {
|
|
69256
69398
|
try {
|
|
69257
|
-
const hooksConfig = JSON.parse((0,
|
|
69399
|
+
const hooksConfig = JSON.parse((0, import_fs43.readFileSync)(cursorHooksJsonPath, "utf-8"));
|
|
69258
69400
|
const hookTypes = ["beforeShellExecution", "beforeSubmitPrompt"];
|
|
69259
69401
|
for (const hookType of hookTypes) {
|
|
69260
69402
|
if (hooksConfig.hooks?.[hookType]) {
|
|
@@ -69280,8 +69422,8 @@ function detectUserLevelItems(options) {
|
|
|
69280
69422
|
}
|
|
69281
69423
|
function detectProjectLevelItems(directory) {
|
|
69282
69424
|
const items = [];
|
|
69283
|
-
const galDir = (0,
|
|
69284
|
-
if ((0,
|
|
69425
|
+
const galDir = (0, import_path42.join)(directory, ".gal");
|
|
69426
|
+
if ((0, import_fs43.existsSync)(galDir)) {
|
|
69285
69427
|
items.push({
|
|
69286
69428
|
path: galDir,
|
|
69287
69429
|
type: "directory",
|
|
@@ -69289,8 +69431,8 @@ function detectProjectLevelItems(directory) {
|
|
|
69289
69431
|
isGalOwned: true
|
|
69290
69432
|
});
|
|
69291
69433
|
}
|
|
69292
|
-
const galConfig = (0,
|
|
69293
|
-
if ((0,
|
|
69434
|
+
const galConfig = (0, import_path42.join)(directory, "gal.config.json");
|
|
69435
|
+
if ((0, import_fs43.existsSync)(galConfig)) {
|
|
69294
69436
|
items.push({
|
|
69295
69437
|
path: galConfig,
|
|
69296
69438
|
type: "file",
|
|
@@ -69299,11 +69441,11 @@ function detectProjectLevelItems(directory) {
|
|
|
69299
69441
|
});
|
|
69300
69442
|
}
|
|
69301
69443
|
const gitHookPaths = [
|
|
69302
|
-
(0,
|
|
69303
|
-
(0,
|
|
69444
|
+
(0, import_path42.join)(directory, ".git", "hooks", "pre-commit"),
|
|
69445
|
+
(0, import_path42.join)(directory, ".husky", "pre-commit")
|
|
69304
69446
|
];
|
|
69305
69447
|
for (const hookPath of gitHookPaths) {
|
|
69306
|
-
if ((0,
|
|
69448
|
+
if ((0, import_fs43.existsSync)(hookPath) && isGalCreatedFile(hookPath)) {
|
|
69307
69449
|
items.push({
|
|
69308
69450
|
path: hookPath,
|
|
69309
69451
|
type: "file",
|
|
@@ -69313,18 +69455,18 @@ function detectProjectLevelItems(directory) {
|
|
|
69313
69455
|
}
|
|
69314
69456
|
}
|
|
69315
69457
|
const setupFiles = [
|
|
69316
|
-
{ path: (0,
|
|
69317
|
-
{ path: (0,
|
|
69318
|
-
{ path: (0,
|
|
69319
|
-
{ path: (0,
|
|
69320
|
-
{ path: (0,
|
|
69321
|
-
{ path: (0,
|
|
69322
|
-
{ path: (0,
|
|
69323
|
-
{ path: (0,
|
|
69324
|
-
{ path: (0,
|
|
69458
|
+
{ path: (0, import_path42.join)(directory, "CLAUDE.md"), reason: "GAL-generated CLAUDE.md" },
|
|
69459
|
+
{ path: (0, import_path42.join)(directory, ".claude", "settings.json"), reason: "GAL-generated settings" },
|
|
69460
|
+
{ path: (0, import_path42.join)(directory, ".claude", "commands", "review.md"), reason: "GAL-generated command" },
|
|
69461
|
+
{ path: (0, import_path42.join)(directory, ".claude", "commands", "check.md"), reason: "GAL-generated command" },
|
|
69462
|
+
{ path: (0, import_path42.join)(directory, ".github", "workflows", "ci.yml"), reason: "GAL-generated workflow" },
|
|
69463
|
+
{ path: (0, import_path42.join)(directory, ".github", "workflows", "pr-governance.yml"), reason: "GAL-generated workflow" },
|
|
69464
|
+
{ path: (0, import_path42.join)(directory, ".gitleaks.toml"), reason: "GAL-generated security config" },
|
|
69465
|
+
{ path: (0, import_path42.join)(directory, "SECURITY.md"), reason: "GAL-generated security docs" },
|
|
69466
|
+
{ path: (0, import_path42.join)(directory, ".env.example"), reason: "GAL-generated env template" }
|
|
69325
69467
|
];
|
|
69326
69468
|
for (const { path: path8, reason } of setupFiles) {
|
|
69327
|
-
if ((0,
|
|
69469
|
+
if ((0, import_fs43.existsSync)(path8) && isGalCreatedFile(path8)) {
|
|
69328
69470
|
items.push({
|
|
69329
69471
|
path: path8,
|
|
69330
69472
|
type: "file",
|
|
@@ -69337,12 +69479,12 @@ function detectProjectLevelItems(directory) {
|
|
|
69337
69479
|
}
|
|
69338
69480
|
function removeGalStatusLineEntry(settingsPath) {
|
|
69339
69481
|
try {
|
|
69340
|
-
const settings = JSON.parse((0,
|
|
69482
|
+
const settings = JSON.parse((0, import_fs43.readFileSync)(settingsPath, "utf-8"));
|
|
69341
69483
|
if (!settings.statusLine?.command?.includes("gal-")) {
|
|
69342
69484
|
return false;
|
|
69343
69485
|
}
|
|
69344
69486
|
delete settings.statusLine;
|
|
69345
|
-
(0,
|
|
69487
|
+
(0, import_fs43.writeFileSync)(settingsPath, JSON.stringify(settings, null, 2));
|
|
69346
69488
|
return true;
|
|
69347
69489
|
} catch {
|
|
69348
69490
|
return false;
|
|
@@ -69350,7 +69492,7 @@ function removeGalStatusLineEntry(settingsPath) {
|
|
|
69350
69492
|
}
|
|
69351
69493
|
function removeGalHookEntries(settingsPath) {
|
|
69352
69494
|
try {
|
|
69353
|
-
const settings = JSON.parse((0,
|
|
69495
|
+
const settings = JSON.parse((0, import_fs43.readFileSync)(settingsPath, "utf-8"));
|
|
69354
69496
|
let modified = false;
|
|
69355
69497
|
for (const hookEvent of ["SessionStart", "UserPromptSubmit"]) {
|
|
69356
69498
|
if (!settings.hooks?.[hookEvent]) continue;
|
|
@@ -69373,7 +69515,7 @@ function removeGalHookEntries(settingsPath) {
|
|
|
69373
69515
|
delete settings.hooks;
|
|
69374
69516
|
}
|
|
69375
69517
|
if (modified) {
|
|
69376
|
-
(0,
|
|
69518
|
+
(0, import_fs43.writeFileSync)(settingsPath, JSON.stringify(settings, null, 2));
|
|
69377
69519
|
return true;
|
|
69378
69520
|
}
|
|
69379
69521
|
return false;
|
|
@@ -69383,7 +69525,7 @@ function removeGalHookEntries(settingsPath) {
|
|
|
69383
69525
|
}
|
|
69384
69526
|
function removeGalCursorHookEntries(hooksJsonPath) {
|
|
69385
69527
|
try {
|
|
69386
|
-
const hooksConfig = JSON.parse((0,
|
|
69528
|
+
const hooksConfig = JSON.parse((0, import_fs43.readFileSync)(hooksJsonPath, "utf-8"));
|
|
69387
69529
|
if (!hooksConfig.hooks) {
|
|
69388
69530
|
return false;
|
|
69389
69531
|
}
|
|
@@ -69407,7 +69549,7 @@ function removeGalCursorHookEntries(hooksJsonPath) {
|
|
|
69407
69549
|
delete hooksConfig.hooks;
|
|
69408
69550
|
}
|
|
69409
69551
|
if (modified) {
|
|
69410
|
-
(0,
|
|
69552
|
+
(0, import_fs43.writeFileSync)(hooksJsonPath, JSON.stringify(hooksConfig, null, 2));
|
|
69411
69553
|
return true;
|
|
69412
69554
|
}
|
|
69413
69555
|
return false;
|
|
@@ -69442,10 +69584,10 @@ function performUninstall(items, dryRun) {
|
|
|
69442
69584
|
result.skipped.push(`${item.path} (no GAL statusLine found)`);
|
|
69443
69585
|
}
|
|
69444
69586
|
} else if (item.type === "directory") {
|
|
69445
|
-
(0,
|
|
69587
|
+
(0, import_fs43.rmSync)(item.path, { recursive: true, force: true });
|
|
69446
69588
|
result.removed.push(item.path);
|
|
69447
69589
|
} else {
|
|
69448
|
-
(0,
|
|
69590
|
+
(0, import_fs43.unlinkSync)(item.path);
|
|
69449
69591
|
result.removed.push(item.path);
|
|
69450
69592
|
}
|
|
69451
69593
|
} catch (error3) {
|
|
@@ -69541,15 +69683,15 @@ function createUninstallCommand() {
|
|
|
69541
69683
|
});
|
|
69542
69684
|
return command;
|
|
69543
69685
|
}
|
|
69544
|
-
var
|
|
69686
|
+
var import_fs43, import_path42, import_os26, import_readline4;
|
|
69545
69687
|
var init_uninstall = __esm({
|
|
69546
69688
|
"src/commands/uninstall.ts"() {
|
|
69547
69689
|
"use strict";
|
|
69548
69690
|
init_esm();
|
|
69549
69691
|
init_source();
|
|
69550
|
-
|
|
69551
|
-
|
|
69552
|
-
|
|
69692
|
+
import_fs43 = require("fs");
|
|
69693
|
+
import_path42 = require("path");
|
|
69694
|
+
import_os26 = require("os");
|
|
69553
69695
|
import_readline4 = require("readline");
|
|
69554
69696
|
}
|
|
69555
69697
|
});
|
|
@@ -69928,7 +70070,7 @@ function getRegistryAuthToken() {
|
|
|
69928
70070
|
return void 0;
|
|
69929
70071
|
}
|
|
69930
70072
|
function fetchLatestVersion() {
|
|
69931
|
-
return new Promise((
|
|
70073
|
+
return new Promise((resolve11, reject) => {
|
|
69932
70074
|
const authToken = getRegistryAuthToken();
|
|
69933
70075
|
const req = import_https.default.get(
|
|
69934
70076
|
`${REGISTRY_URL}/@scheduler-systems/gal-run/latest`,
|
|
@@ -69942,7 +70084,7 @@ function fetchLatestVersion() {
|
|
|
69942
70084
|
res.on("end", () => {
|
|
69943
70085
|
try {
|
|
69944
70086
|
const pkg = JSON.parse(data);
|
|
69945
|
-
|
|
70087
|
+
resolve11(pkg.version);
|
|
69946
70088
|
} catch {
|
|
69947
70089
|
reject(new Error("Failed to parse registry response"));
|
|
69948
70090
|
}
|
|
@@ -69967,27 +70109,27 @@ function compareVersions2(v1, v2) {
|
|
|
69967
70109
|
}
|
|
69968
70110
|
function acquireLock() {
|
|
69969
70111
|
try {
|
|
69970
|
-
const galDir = (0,
|
|
69971
|
-
if (!(0,
|
|
69972
|
-
(0,
|
|
70112
|
+
const galDir = (0, import_path43.join)((0, import_os27.homedir)(), ".gal");
|
|
70113
|
+
if (!(0, import_fs44.existsSync)(galDir)) {
|
|
70114
|
+
(0, import_fs44.mkdirSync)(galDir, { recursive: true });
|
|
69973
70115
|
}
|
|
69974
|
-
if ((0,
|
|
70116
|
+
if ((0, import_fs44.existsSync)(UPDATE_LOCK_FILE)) {
|
|
69975
70117
|
try {
|
|
69976
|
-
const lockContent = (0,
|
|
70118
|
+
const lockContent = (0, import_fs44.readFileSync)(UPDATE_LOCK_FILE, "utf-8");
|
|
69977
70119
|
const lockTime = parseInt(lockContent, 10);
|
|
69978
70120
|
if (Number.isNaN(lockTime) || Date.now() - lockTime > 5 * 60 * 1e3) {
|
|
69979
|
-
(0,
|
|
70121
|
+
(0, import_fs44.unlinkSync)(UPDATE_LOCK_FILE);
|
|
69980
70122
|
} else {
|
|
69981
70123
|
return false;
|
|
69982
70124
|
}
|
|
69983
70125
|
} catch {
|
|
69984
70126
|
try {
|
|
69985
|
-
(0,
|
|
70127
|
+
(0, import_fs44.unlinkSync)(UPDATE_LOCK_FILE);
|
|
69986
70128
|
} catch {
|
|
69987
70129
|
}
|
|
69988
70130
|
}
|
|
69989
70131
|
}
|
|
69990
|
-
(0,
|
|
70132
|
+
(0, import_fs44.writeFileSync)(UPDATE_LOCK_FILE, String(Date.now()), { flag: "wx" });
|
|
69991
70133
|
return true;
|
|
69992
70134
|
} catch {
|
|
69993
70135
|
return false;
|
|
@@ -69995,8 +70137,8 @@ function acquireLock() {
|
|
|
69995
70137
|
}
|
|
69996
70138
|
function releaseLock() {
|
|
69997
70139
|
try {
|
|
69998
|
-
if ((0,
|
|
69999
|
-
(0,
|
|
70140
|
+
if ((0, import_fs44.existsSync)(UPDATE_LOCK_FILE)) {
|
|
70141
|
+
(0, import_fs44.unlinkSync)(UPDATE_LOCK_FILE);
|
|
70000
70142
|
}
|
|
70001
70143
|
} catch {
|
|
70002
70144
|
}
|
|
@@ -70107,7 +70249,7 @@ Retry manually with: ${source_default.cyan(installCommand)}`);
|
|
|
70107
70249
|
});
|
|
70108
70250
|
return command;
|
|
70109
70251
|
}
|
|
70110
|
-
var import_https, import_child_process13,
|
|
70252
|
+
var import_https, import_child_process13, import_fs44, import_path43, import_os27, UPDATE_LOCK_FILE, cliVersion7, REGISTRY_URL;
|
|
70111
70253
|
var init_update = __esm({
|
|
70112
70254
|
"src/commands/update.ts"() {
|
|
70113
70255
|
"use strict";
|
|
@@ -70116,14 +70258,14 @@ var init_update = __esm({
|
|
|
70116
70258
|
init_ora();
|
|
70117
70259
|
import_https = __toESM(require("https"), 1);
|
|
70118
70260
|
import_child_process13 = require("child_process");
|
|
70119
|
-
|
|
70120
|
-
|
|
70121
|
-
|
|
70261
|
+
import_fs44 = require("fs");
|
|
70262
|
+
import_path43 = require("path");
|
|
70263
|
+
import_os27 = require("os");
|
|
70122
70264
|
init_constants();
|
|
70123
70265
|
init_path_conflict();
|
|
70124
70266
|
init_install();
|
|
70125
70267
|
init_telemetry();
|
|
70126
|
-
UPDATE_LOCK_FILE = (0,
|
|
70268
|
+
UPDATE_LOCK_FILE = (0, import_path43.join)((0, import_os27.homedir)(), ".gal", "update.lock");
|
|
70127
70269
|
cliVersion7 = constants_default[0];
|
|
70128
70270
|
REGISTRY_URL = getRegistryUrl();
|
|
70129
70271
|
}
|
|
@@ -70631,9 +70773,9 @@ function createWorkflowCommand() {
|
|
|
70631
70773
|
const apiUrl = process.env.GAL_API_URL || defaultApiUrl18;
|
|
70632
70774
|
try {
|
|
70633
70775
|
const spinner = ora(`Reading ${filePath}...`).start();
|
|
70634
|
-
const absolutePath =
|
|
70776
|
+
const absolutePath = import_path44.default.resolve(filePath);
|
|
70635
70777
|
const content = await import_promises9.default.readFile(absolutePath, "utf-8");
|
|
70636
|
-
const fileName =
|
|
70778
|
+
const fileName = import_path44.default.basename(filePath);
|
|
70637
70779
|
let type = options.type;
|
|
70638
70780
|
if (!type) {
|
|
70639
70781
|
if (fileName.endsWith(".md")) {
|
|
@@ -70689,7 +70831,7 @@ function createWorkflowCommand() {
|
|
|
70689
70831
|
spinner.fail(source_default.red("No organization found. Please connect GitHub via dashboard or use --org flag"));
|
|
70690
70832
|
process.exit(1);
|
|
70691
70833
|
}
|
|
70692
|
-
const dirPath =
|
|
70834
|
+
const dirPath = import_path44.default.resolve(directory);
|
|
70693
70835
|
const files = await import_promises9.default.readdir(dirPath);
|
|
70694
70836
|
const workflowFiles = files.filter(
|
|
70695
70837
|
(f) => f.endsWith(".md") || f.includes("hook") && (f.endsWith(".json") || f.endsWith(".py") || f.endsWith(".js"))
|
|
@@ -70701,7 +70843,7 @@ function createWorkflowCommand() {
|
|
|
70701
70843
|
spinner.text = `Found ${workflowFiles.length} workflow files. Preparing batch test...`;
|
|
70702
70844
|
const requests = [];
|
|
70703
70845
|
for (const file of workflowFiles) {
|
|
70704
|
-
const filePath =
|
|
70846
|
+
const filePath = import_path44.default.join(dirPath, file);
|
|
70705
70847
|
const content = await import_promises9.default.readFile(filePath, "utf-8");
|
|
70706
70848
|
const type = file.endsWith(".md") ? "command" : "hook";
|
|
70707
70849
|
requests.push({
|
|
@@ -70799,7 +70941,7 @@ function displayTestResult(result) {
|
|
|
70799
70941
|
}
|
|
70800
70942
|
console.log();
|
|
70801
70943
|
}
|
|
70802
|
-
var import_promises9,
|
|
70944
|
+
var import_promises9, import_path44, defaultApiUrl18;
|
|
70803
70945
|
var init_workflow2 = __esm({
|
|
70804
70946
|
"src/commands/workflow.ts"() {
|
|
70805
70947
|
"use strict";
|
|
@@ -70807,7 +70949,7 @@ var init_workflow2 = __esm({
|
|
|
70807
70949
|
init_source();
|
|
70808
70950
|
init_ora();
|
|
70809
70951
|
import_promises9 = __toESM(require("fs/promises"), 1);
|
|
70810
|
-
|
|
70952
|
+
import_path44 = __toESM(require("path"), 1);
|
|
70811
70953
|
init_constants();
|
|
70812
70954
|
init_client();
|
|
70813
70955
|
defaultApiUrl18 = constants_default[1];
|
|
@@ -71023,6 +71165,7 @@ var init_command_registry = __esm({
|
|
|
71023
71165
|
init_fleet();
|
|
71024
71166
|
init_headless();
|
|
71025
71167
|
init_hooks();
|
|
71168
|
+
init_init();
|
|
71026
71169
|
init_install2();
|
|
71027
71170
|
init_join();
|
|
71028
71171
|
init_maintain();
|
|
@@ -71075,6 +71218,7 @@ var init_command_registry = __esm({
|
|
|
71075
71218
|
{ name: "fleet", create: createFleetCommand },
|
|
71076
71219
|
{ name: "headless", create: createHeadlessCommand },
|
|
71077
71220
|
{ name: "hooks", create: createHooksCommand },
|
|
71221
|
+
{ name: "init", create: createInitCommand },
|
|
71078
71222
|
{ name: "install", create: createInstallCommand },
|
|
71079
71223
|
{ name: "join", create: createJoinCommand },
|
|
71080
71224
|
{ name: "maintain", create: createMaintainCommand },
|
|
@@ -71111,7 +71255,7 @@ var init_command_registry = __esm({
|
|
|
71111
71255
|
|
|
71112
71256
|
// src/utils/branding.ts
|
|
71113
71257
|
function printBranding() {
|
|
71114
|
-
if (process.argv.includes("--json") || process.argv.includes("-j") || process.argv.includes("--no-color") || process.env.CI === "true" || process.env.NO_COLOR !== void 0) {
|
|
71258
|
+
if (process.argv.includes("--json") || process.argv.includes("-j") || process.argv.includes("--auto") || process.argv.includes("--no-color") || process.env.CI === "true" || process.env.NO_COLOR !== void 0) {
|
|
71115
71259
|
return;
|
|
71116
71260
|
}
|
|
71117
71261
|
console.log(
|
|
@@ -71139,11 +71283,11 @@ function getRegistryAuthToken2() {
|
|
|
71139
71283
|
return void 0;
|
|
71140
71284
|
}
|
|
71141
71285
|
try {
|
|
71142
|
-
const npmrcPath = (0,
|
|
71143
|
-
if (!(0,
|
|
71286
|
+
const npmrcPath = (0, import_path45.join)((0, import_os28.homedir)(), ".npmrc");
|
|
71287
|
+
if (!(0, import_fs45.existsSync)(npmrcPath)) {
|
|
71144
71288
|
return void 0;
|
|
71145
71289
|
}
|
|
71146
|
-
const npmrc = (0,
|
|
71290
|
+
const npmrc = (0, import_fs45.readFileSync)(npmrcPath, "utf-8");
|
|
71147
71291
|
const escapedHost = REGISTRY_HOST.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
71148
71292
|
const match = npmrc.match(
|
|
71149
71293
|
new RegExp(`^//${escapedHost}/:_authToken=(.+)$`, "m")
|
|
@@ -71163,8 +71307,8 @@ function getRegistryAuthToken2() {
|
|
|
71163
71307
|
}
|
|
71164
71308
|
function readUpdateCache() {
|
|
71165
71309
|
try {
|
|
71166
|
-
if ((0,
|
|
71167
|
-
return JSON.parse((0,
|
|
71310
|
+
if ((0, import_fs45.existsSync)(UPDATE_CACHE_FILE)) {
|
|
71311
|
+
return JSON.parse((0, import_fs45.readFileSync)(UPDATE_CACHE_FILE, "utf-8"));
|
|
71168
71312
|
}
|
|
71169
71313
|
} catch {
|
|
71170
71314
|
}
|
|
@@ -71172,10 +71316,10 @@ function readUpdateCache() {
|
|
|
71172
71316
|
}
|
|
71173
71317
|
function writeUpdateCache(cache) {
|
|
71174
71318
|
try {
|
|
71175
|
-
if (!(0,
|
|
71176
|
-
(0,
|
|
71319
|
+
if (!(0, import_fs45.existsSync)(UPDATE_CACHE_DIR)) {
|
|
71320
|
+
(0, import_fs45.mkdirSync)(UPDATE_CACHE_DIR, { recursive: true });
|
|
71177
71321
|
}
|
|
71178
|
-
(0,
|
|
71322
|
+
(0, import_fs45.writeFileSync)(UPDATE_CACHE_FILE, JSON.stringify(cache));
|
|
71179
71323
|
} catch {
|
|
71180
71324
|
}
|
|
71181
71325
|
}
|
|
@@ -71206,7 +71350,7 @@ function isPreReleaseVersion(version2) {
|
|
|
71206
71350
|
return /-(preview|pr|rc|dev)/i.test(version2);
|
|
71207
71351
|
}
|
|
71208
71352
|
async function promptUpdateInteractive(currentVersion, latestVersion) {
|
|
71209
|
-
return new Promise((
|
|
71353
|
+
return new Promise((resolve11) => {
|
|
71210
71354
|
const rl = import_readline5.default.createInterface({
|
|
71211
71355
|
input: process.stdin,
|
|
71212
71356
|
output: process.stdout
|
|
@@ -71218,20 +71362,20 @@ async function promptUpdateInteractive(currentVersion, latestVersion) {
|
|
|
71218
71362
|
(answer) => {
|
|
71219
71363
|
rl.close();
|
|
71220
71364
|
const trimmed = answer.trim().toLowerCase();
|
|
71221
|
-
|
|
71365
|
+
resolve11(trimmed !== "n" && trimmed !== "no");
|
|
71222
71366
|
}
|
|
71223
71367
|
);
|
|
71224
71368
|
});
|
|
71225
71369
|
}
|
|
71226
71370
|
async function runInlineUpdate() {
|
|
71227
|
-
return new Promise((
|
|
71371
|
+
return new Promise((resolve11, reject) => {
|
|
71228
71372
|
const child = (0, import_child_process14.spawn)("gal", ["update"], {
|
|
71229
71373
|
stdio: "inherit",
|
|
71230
71374
|
env: { ...process.env, GAL_AUTO_UPDATE: "0" }
|
|
71231
71375
|
});
|
|
71232
71376
|
child.on("close", (code) => {
|
|
71233
71377
|
if (code === 0) {
|
|
71234
|
-
|
|
71378
|
+
resolve11();
|
|
71235
71379
|
} else {
|
|
71236
71380
|
reject(new Error(`gal update exited with code ${code}`));
|
|
71237
71381
|
}
|
|
@@ -71313,8 +71457,8 @@ async function checkForUpdates() {
|
|
|
71313
71457
|
});
|
|
71314
71458
|
if (!isUpdateCommand && !isCI && !isAutoUpdateDisabled) {
|
|
71315
71459
|
try {
|
|
71316
|
-
const lockFile = (0,
|
|
71317
|
-
if (!(0,
|
|
71460
|
+
const lockFile = (0, import_path45.join)((0, import_os28.homedir)(), ".gal", "update.lock");
|
|
71461
|
+
if (!(0, import_fs45.existsSync)(lockFile)) {
|
|
71318
71462
|
const child = (0, import_child_process14.spawn)("gal", ["update"], {
|
|
71319
71463
|
detached: true,
|
|
71320
71464
|
stdio: "ignore",
|
|
@@ -71363,9 +71507,9 @@ async function checkForUpdates() {
|
|
|
71363
71507
|
function checkPathConflicts() {
|
|
71364
71508
|
try {
|
|
71365
71509
|
if (process.env.CI === "true" || process.argv.includes("--json")) return;
|
|
71366
|
-
const CONFLICT_CACHE = (0,
|
|
71367
|
-
if ((0,
|
|
71368
|
-
const cached2 = JSON.parse((0,
|
|
71510
|
+
const CONFLICT_CACHE = (0, import_path45.join)(UPDATE_CACHE_DIR, "path-conflict-cache.json");
|
|
71511
|
+
if ((0, import_fs45.existsSync)(CONFLICT_CACHE)) {
|
|
71512
|
+
const cached2 = JSON.parse((0, import_fs45.readFileSync)(CONFLICT_CACHE, "utf-8"));
|
|
71369
71513
|
if (Date.now() - (cached2.lastCheck || 0) < ONE_DAY) {
|
|
71370
71514
|
if (cached2.hasConflict) {
|
|
71371
71515
|
process.on("exit", () => {
|
|
@@ -71379,10 +71523,10 @@ function checkPathConflicts() {
|
|
|
71379
71523
|
const conflict = detectPathConflict(cliVersion9);
|
|
71380
71524
|
const cacheData = { lastCheck: Date.now(), hasConflict: !!conflict };
|
|
71381
71525
|
try {
|
|
71382
|
-
if (!(0,
|
|
71383
|
-
(0,
|
|
71526
|
+
if (!(0, import_fs45.existsSync)(UPDATE_CACHE_DIR)) {
|
|
71527
|
+
(0, import_fs45.mkdirSync)(UPDATE_CACHE_DIR, { recursive: true });
|
|
71384
71528
|
}
|
|
71385
|
-
(0,
|
|
71529
|
+
(0, import_fs45.writeFileSync)(CONFLICT_CACHE, JSON.stringify(cacheData));
|
|
71386
71530
|
} catch {
|
|
71387
71531
|
}
|
|
71388
71532
|
if (conflict) {
|
|
@@ -71395,9 +71539,9 @@ function checkPathConflicts() {
|
|
|
71395
71539
|
}
|
|
71396
71540
|
function refreshOrgMemberships() {
|
|
71397
71541
|
try {
|
|
71398
|
-
const configPath = (0,
|
|
71399
|
-
if (!(0,
|
|
71400
|
-
const config2 = JSON.parse((0,
|
|
71542
|
+
const configPath = (0, import_path45.join)((0, import_os28.homedir)(), ".gal", "config.json");
|
|
71543
|
+
if (!(0, import_fs45.existsSync)(configPath)) return;
|
|
71544
|
+
const config2 = JSON.parse((0, import_fs45.readFileSync)(configPath, "utf-8"));
|
|
71401
71545
|
if (!config2.authToken) return;
|
|
71402
71546
|
const checkedAt = config2.orgMembershipsCheckedAt || 0;
|
|
71403
71547
|
if (Date.now() - checkedAt < ONE_DAY) return;
|
|
@@ -71429,10 +71573,10 @@ function refreshOrgMemberships() {
|
|
|
71429
71573
|
config2.capabilities = user.capabilities;
|
|
71430
71574
|
config2.capabilitiesCachedAt = Date.now();
|
|
71431
71575
|
}
|
|
71432
|
-
if (!(0,
|
|
71433
|
-
(0,
|
|
71576
|
+
if (!(0, import_fs45.existsSync)(UPDATE_CACHE_DIR)) {
|
|
71577
|
+
(0, import_fs45.mkdirSync)(UPDATE_CACHE_DIR, { recursive: true });
|
|
71434
71578
|
}
|
|
71435
|
-
(0,
|
|
71579
|
+
(0, import_fs45.writeFileSync)(configPath, JSON.stringify(config2, null, 2));
|
|
71436
71580
|
}
|
|
71437
71581
|
} catch {
|
|
71438
71582
|
}
|
|
@@ -71459,11 +71603,11 @@ function refreshOrgMemberships() {
|
|
|
71459
71603
|
if (res.statusCode !== 200) return;
|
|
71460
71604
|
const flags = JSON.parse(data);
|
|
71461
71605
|
if (flags.orgAudienceTierMap) {
|
|
71462
|
-
const freshConfig = JSON.parse((0,
|
|
71606
|
+
const freshConfig = JSON.parse((0, import_fs45.readFileSync)(configPath, "utf-8"));
|
|
71463
71607
|
freshConfig.orgAudienceTierMap = flags.orgAudienceTierMap;
|
|
71464
71608
|
freshConfig.orgPlanMap = flags.orgPlanMap || freshConfig.orgPlanMap || {};
|
|
71465
71609
|
freshConfig.flagsCachedAt = Date.now();
|
|
71466
|
-
(0,
|
|
71610
|
+
(0, import_fs45.writeFileSync)(configPath, JSON.stringify(freshConfig, null, 2));
|
|
71467
71611
|
}
|
|
71468
71612
|
} catch {
|
|
71469
71613
|
}
|
|
@@ -71482,7 +71626,7 @@ function refreshOrgMemberships() {
|
|
|
71482
71626
|
} catch {
|
|
71483
71627
|
}
|
|
71484
71628
|
}
|
|
71485
|
-
var import_dotenv, import_https2, import_readline5, import_child_process14,
|
|
71629
|
+
var import_dotenv, import_https2, import_readline5, import_child_process14, import_fs45, import_path45, import_os28, originalEmit, GLOBAL_TIMEOUT_MS, globalTimeout, cliVersion9, UPDATE_CACHE_DIR, UPDATE_CACHE_FILE, ONE_DAY, REGISTRY_URL2, REGISTRY_HOST, sessionStartTime, isReadOnlyStatusCommand, isMachineMode, exitHooksRan, featureFlags, knownCommands, isKnownCommand, program2, allInternalFlags;
|
|
71486
71630
|
var init_index = __esm({
|
|
71487
71631
|
"src/index.ts"() {
|
|
71488
71632
|
"use strict";
|
|
@@ -71491,9 +71635,9 @@ var init_index = __esm({
|
|
|
71491
71635
|
import_https2 = __toESM(require("https"), 1);
|
|
71492
71636
|
import_readline5 = __toESM(require("readline"), 1);
|
|
71493
71637
|
import_child_process14 = require("child_process");
|
|
71494
|
-
|
|
71495
|
-
|
|
71496
|
-
|
|
71638
|
+
import_fs45 = require("fs");
|
|
71639
|
+
import_path45 = require("path");
|
|
71640
|
+
import_os28 = require("os");
|
|
71497
71641
|
init_source();
|
|
71498
71642
|
init_constants();
|
|
71499
71643
|
init_sentry2();
|
|
@@ -71523,8 +71667,8 @@ var init_index = __esm({
|
|
|
71523
71667
|
}, GLOBAL_TIMEOUT_MS);
|
|
71524
71668
|
globalTimeout.unref();
|
|
71525
71669
|
cliVersion9 = constants_default[0];
|
|
71526
|
-
UPDATE_CACHE_DIR = (0,
|
|
71527
|
-
UPDATE_CACHE_FILE = (0,
|
|
71670
|
+
UPDATE_CACHE_DIR = (0, import_path45.join)((0, import_os28.homedir)(), ".gal");
|
|
71671
|
+
UPDATE_CACHE_FILE = (0, import_path45.join)(UPDATE_CACHE_DIR, "update-cache.json");
|
|
71528
71672
|
ONE_DAY = 24 * 60 * 60 * 1e3;
|
|
71529
71673
|
REGISTRY_URL2 = (() => {
|
|
71530
71674
|
const raw = process.env.GAL_REGISTRY_URL || "https://registry.npmjs.org";
|
|
@@ -71671,7 +71815,7 @@ var init_index = __esm({
|
|
|
71671
71815
|
});
|
|
71672
71816
|
|
|
71673
71817
|
// src/bootstrap.ts
|
|
71674
|
-
var cliVersion10 = true ? "0.0.
|
|
71818
|
+
var cliVersion10 = true ? "0.0.408" : "0.0.0-dev";
|
|
71675
71819
|
var args = process.argv.slice(2);
|
|
71676
71820
|
var requestedGlobalHelp = args.length === 1 && (args[0] === "--help" || args[0] === "-h");
|
|
71677
71821
|
var requestedVersion = args.length === 1 && (args[0] === "--version" || args[0] === "-V");
|
|
@@ -71683,6 +71827,7 @@ var globalHelpCommands = [
|
|
|
71683
71827
|
" feedback [options] Send feedback about GAL",
|
|
71684
71828
|
" fetch [orgName] Fetch agent configurations from GAL API and write to local directory",
|
|
71685
71829
|
" hooks Manage AI agent hooks for auto-sync",
|
|
71830
|
+
" init [options] Initialize directory for GAL auto-sync",
|
|
71686
71831
|
" join [options] Join an organization using an invite code",
|
|
71687
71832
|
" mcp Set up and validate GAL hosted MCP connectivity",
|
|
71688
71833
|
" memory Manage user-scope AI agent memory (no auth required)",
|