@scheduler-systems/gal-run 0.0.469 → 0.0.471
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 +1110 -885
- package/dist/postinstall.cjs +1 -1
- package/package.json +1 -1
- package/scripts/postinstall.cjs +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3159,7 +3159,7 @@ var require_main = __commonJS({
|
|
|
3159
3159
|
return supportsAnsi() ? `\x1B[2m${text}\x1B[0m` : text;
|
|
3160
3160
|
}
|
|
3161
3161
|
var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
|
|
3162
|
-
function
|
|
3162
|
+
function parse5(src) {
|
|
3163
3163
|
const obj = {};
|
|
3164
3164
|
let lines = src.toString();
|
|
3165
3165
|
lines = lines.replace(/\r\n?/mg, "\n");
|
|
@@ -3431,7 +3431,7 @@ var require_main = __commonJS({
|
|
|
3431
3431
|
_parseVault,
|
|
3432
3432
|
config: config2,
|
|
3433
3433
|
decrypt,
|
|
3434
|
-
parse:
|
|
3434
|
+
parse: parse5,
|
|
3435
3435
|
populate
|
|
3436
3436
|
};
|
|
3437
3437
|
module2.exports.configDotenv = DotenvModule.configDotenv;
|
|
@@ -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.471" : "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;
|
|
@@ -11678,7 +11678,7 @@ var require_public_api = __commonJS({
|
|
|
11678
11678
|
}
|
|
11679
11679
|
return doc;
|
|
11680
11680
|
}
|
|
11681
|
-
function
|
|
11681
|
+
function parse5(src, reviver, options) {
|
|
11682
11682
|
let _reviver = void 0;
|
|
11683
11683
|
if (typeof reviver === "function") {
|
|
11684
11684
|
_reviver = reviver;
|
|
@@ -11719,7 +11719,7 @@ var require_public_api = __commonJS({
|
|
|
11719
11719
|
return value.toString(options);
|
|
11720
11720
|
return new Document.Document(value, _replacer, options).toString(options);
|
|
11721
11721
|
}
|
|
11722
|
-
exports2.parse =
|
|
11722
|
+
exports2.parse = parse5;
|
|
11723
11723
|
exports2.parseAllDocuments = parseAllDocuments;
|
|
11724
11724
|
exports2.parseDocument = parseDocument;
|
|
11725
11725
|
exports2.stringify = stringify;
|
|
@@ -11803,7 +11803,7 @@ function detectEnvironment() {
|
|
|
11803
11803
|
return "dev";
|
|
11804
11804
|
}
|
|
11805
11805
|
try {
|
|
11806
|
-
const version2 = true ? "0.0.
|
|
11806
|
+
const version2 = true ? "0.0.471" : void 0;
|
|
11807
11807
|
if (version2 && version2.includes("-local")) {
|
|
11808
11808
|
return "dev";
|
|
11809
11809
|
}
|
|
@@ -14511,7 +14511,7 @@ function getId() {
|
|
|
14511
14511
|
}
|
|
14512
14512
|
function getCliVersion() {
|
|
14513
14513
|
try {
|
|
14514
|
-
return true ? "0.0.
|
|
14514
|
+
return true ? "0.0.471" : "0.0.0-dev";
|
|
14515
14515
|
} catch {
|
|
14516
14516
|
return "0.0.0-dev";
|
|
14517
14517
|
}
|
|
@@ -15821,6 +15821,13 @@ var init_secrets = __esm({
|
|
|
15821
15821
|
}
|
|
15822
15822
|
});
|
|
15823
15823
|
|
|
15824
|
+
// ../../packages/types/dist/environments.js
|
|
15825
|
+
var init_environments = __esm({
|
|
15826
|
+
"../../packages/types/dist/environments.js"() {
|
|
15827
|
+
"use strict";
|
|
15828
|
+
}
|
|
15829
|
+
});
|
|
15830
|
+
|
|
15824
15831
|
// ../../packages/types/dist/learning.js
|
|
15825
15832
|
var init_learning = __esm({
|
|
15826
15833
|
"../../packages/types/dist/learning.js"() {
|
|
@@ -16196,6 +16203,7 @@ var init_dist2 = __esm({
|
|
|
16196
16203
|
init_sso();
|
|
16197
16204
|
init_memory();
|
|
16198
16205
|
init_secrets();
|
|
16206
|
+
init_environments();
|
|
16199
16207
|
init_learning();
|
|
16200
16208
|
init_enforcement_mode();
|
|
16201
16209
|
init_sdlc_evaluation();
|
|
@@ -17796,11 +17804,11 @@ function getFeatureFlags() {
|
|
|
17796
17804
|
let isPartnerFromApi = false;
|
|
17797
17805
|
if (!isInternalEnv) {
|
|
17798
17806
|
try {
|
|
17799
|
-
const { readFileSync: readFileSync45, existsSync:
|
|
17800
|
-
const { join:
|
|
17807
|
+
const { readFileSync: readFileSync45, existsSync: existsSync51 } = require("fs");
|
|
17808
|
+
const { join: join55 } = require("path");
|
|
17801
17809
|
const { homedir: homedir30 } = require("os");
|
|
17802
|
-
const configPath =
|
|
17803
|
-
if (
|
|
17810
|
+
const configPath = join55(homedir30(), ".gal", "config.json");
|
|
17811
|
+
if (existsSync51(configPath)) {
|
|
17804
17812
|
const config2 = JSON.parse(readFileSync45(configPath, "utf-8"));
|
|
17805
17813
|
const cacheAge = Date.now() - (config2.flagsCachedAt || config2.internalOrgsCheckedAt || 0);
|
|
17806
17814
|
if (cacheAge < CACHE_MAX_AGE_MS) {
|
|
@@ -27462,7 +27470,7 @@ var require_thread_stream = __commonJS({
|
|
|
27462
27470
|
var { version: version2 } = require_package2();
|
|
27463
27471
|
var { EventEmitter: EventEmitter3 } = require("events");
|
|
27464
27472
|
var { Worker } = require("worker_threads");
|
|
27465
|
-
var { join:
|
|
27473
|
+
var { join: join55 } = require("path");
|
|
27466
27474
|
var { pathToFileURL } = require("url");
|
|
27467
27475
|
var { wait } = require_wait();
|
|
27468
27476
|
var {
|
|
@@ -27498,7 +27506,7 @@ var require_thread_stream = __commonJS({
|
|
|
27498
27506
|
function createWorker(stream, opts) {
|
|
27499
27507
|
const { filename, workerData } = opts;
|
|
27500
27508
|
const bundlerOverrides = "__bundlerPathsOverrides" in globalThis ? globalThis.__bundlerPathsOverrides : {};
|
|
27501
|
-
const toExecute = bundlerOverrides["thread-stream-worker"] ||
|
|
27509
|
+
const toExecute = bundlerOverrides["thread-stream-worker"] || join55(__dirname, "lib", "worker.js");
|
|
27502
27510
|
const worker = new Worker(toExecute, {
|
|
27503
27511
|
...opts.workerOpts,
|
|
27504
27512
|
trackUnmanagedFds: false,
|
|
@@ -27884,7 +27892,7 @@ var require_transport = __commonJS({
|
|
|
27884
27892
|
"use strict";
|
|
27885
27893
|
var { createRequire: createRequire3 } = require("module");
|
|
27886
27894
|
var getCallers = require_caller();
|
|
27887
|
-
var { join:
|
|
27895
|
+
var { join: join55, isAbsolute, sep } = require("node:path");
|
|
27888
27896
|
var sleep2 = require_atomic_sleep();
|
|
27889
27897
|
var onExit2 = require_on_exit_leak_free();
|
|
27890
27898
|
var ThreadStream = require_thread_stream();
|
|
@@ -27947,7 +27955,7 @@ var require_transport = __commonJS({
|
|
|
27947
27955
|
throw new Error("only one of target or targets can be specified");
|
|
27948
27956
|
}
|
|
27949
27957
|
if (targets) {
|
|
27950
|
-
target = bundlerOverrides["pino-worker"] ||
|
|
27958
|
+
target = bundlerOverrides["pino-worker"] || join55(__dirname, "worker.js");
|
|
27951
27959
|
options.targets = targets.filter((dest) => dest.target).map((dest) => {
|
|
27952
27960
|
return {
|
|
27953
27961
|
...dest,
|
|
@@ -27965,7 +27973,7 @@ var require_transport = __commonJS({
|
|
|
27965
27973
|
});
|
|
27966
27974
|
});
|
|
27967
27975
|
} else if (pipeline) {
|
|
27968
|
-
target = bundlerOverrides["pino-worker"] ||
|
|
27976
|
+
target = bundlerOverrides["pino-worker"] || join55(__dirname, "worker.js");
|
|
27969
27977
|
options.pipelines = [pipeline.map((dest) => {
|
|
27970
27978
|
return {
|
|
27971
27979
|
...dest,
|
|
@@ -27987,7 +27995,7 @@ var require_transport = __commonJS({
|
|
|
27987
27995
|
return origin;
|
|
27988
27996
|
}
|
|
27989
27997
|
if (origin === "pino/file") {
|
|
27990
|
-
return
|
|
27998
|
+
return join55(__dirname, "..", "file.js");
|
|
27991
27999
|
}
|
|
27992
28000
|
let fixTarget2;
|
|
27993
28001
|
for (const filePath of callers) {
|
|
@@ -28976,7 +28984,7 @@ var require_safe_stable_stringify = __commonJS({
|
|
|
28976
28984
|
return circularValue;
|
|
28977
28985
|
}
|
|
28978
28986
|
let res = "";
|
|
28979
|
-
let
|
|
28987
|
+
let join55 = ",";
|
|
28980
28988
|
const originalIndentation = indentation;
|
|
28981
28989
|
if (Array.isArray(value)) {
|
|
28982
28990
|
if (value.length === 0) {
|
|
@@ -28990,7 +28998,7 @@ var require_safe_stable_stringify = __commonJS({
|
|
|
28990
28998
|
indentation += spacer;
|
|
28991
28999
|
res += `
|
|
28992
29000
|
${indentation}`;
|
|
28993
|
-
|
|
29001
|
+
join55 = `,
|
|
28994
29002
|
${indentation}`;
|
|
28995
29003
|
}
|
|
28996
29004
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
@@ -28998,13 +29006,13 @@ ${indentation}`;
|
|
|
28998
29006
|
for (; i < maximumValuesToStringify - 1; i++) {
|
|
28999
29007
|
const tmp2 = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
|
|
29000
29008
|
res += tmp2 !== void 0 ? tmp2 : "null";
|
|
29001
|
-
res +=
|
|
29009
|
+
res += join55;
|
|
29002
29010
|
}
|
|
29003
29011
|
const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
|
|
29004
29012
|
res += tmp !== void 0 ? tmp : "null";
|
|
29005
29013
|
if (value.length - 1 > maximumBreadth) {
|
|
29006
29014
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
29007
|
-
res += `${
|
|
29015
|
+
res += `${join55}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
29008
29016
|
}
|
|
29009
29017
|
if (spacer !== "") {
|
|
29010
29018
|
res += `
|
|
@@ -29025,7 +29033,7 @@ ${originalIndentation}`;
|
|
|
29025
29033
|
let separator = "";
|
|
29026
29034
|
if (spacer !== "") {
|
|
29027
29035
|
indentation += spacer;
|
|
29028
|
-
|
|
29036
|
+
join55 = `,
|
|
29029
29037
|
${indentation}`;
|
|
29030
29038
|
whitespace = " ";
|
|
29031
29039
|
}
|
|
@@ -29039,13 +29047,13 @@ ${indentation}`;
|
|
|
29039
29047
|
const tmp = stringifyFnReplacer(key2, value, stack, replacer, spacer, indentation);
|
|
29040
29048
|
if (tmp !== void 0) {
|
|
29041
29049
|
res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
|
|
29042
|
-
separator =
|
|
29050
|
+
separator = join55;
|
|
29043
29051
|
}
|
|
29044
29052
|
}
|
|
29045
29053
|
if (keyLength > maximumBreadth) {
|
|
29046
29054
|
const removedKeys = keyLength - maximumBreadth;
|
|
29047
29055
|
res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`;
|
|
29048
|
-
separator =
|
|
29056
|
+
separator = join55;
|
|
29049
29057
|
}
|
|
29050
29058
|
if (spacer !== "" && separator.length > 1) {
|
|
29051
29059
|
res = `
|
|
@@ -29086,7 +29094,7 @@ ${originalIndentation}`;
|
|
|
29086
29094
|
}
|
|
29087
29095
|
const originalIndentation = indentation;
|
|
29088
29096
|
let res = "";
|
|
29089
|
-
let
|
|
29097
|
+
let join55 = ",";
|
|
29090
29098
|
if (Array.isArray(value)) {
|
|
29091
29099
|
if (value.length === 0) {
|
|
29092
29100
|
return "[]";
|
|
@@ -29099,7 +29107,7 @@ ${originalIndentation}`;
|
|
|
29099
29107
|
indentation += spacer;
|
|
29100
29108
|
res += `
|
|
29101
29109
|
${indentation}`;
|
|
29102
|
-
|
|
29110
|
+
join55 = `,
|
|
29103
29111
|
${indentation}`;
|
|
29104
29112
|
}
|
|
29105
29113
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
@@ -29107,13 +29115,13 @@ ${indentation}`;
|
|
|
29107
29115
|
for (; i < maximumValuesToStringify - 1; i++) {
|
|
29108
29116
|
const tmp2 = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
|
|
29109
29117
|
res += tmp2 !== void 0 ? tmp2 : "null";
|
|
29110
|
-
res +=
|
|
29118
|
+
res += join55;
|
|
29111
29119
|
}
|
|
29112
29120
|
const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
|
|
29113
29121
|
res += tmp !== void 0 ? tmp : "null";
|
|
29114
29122
|
if (value.length - 1 > maximumBreadth) {
|
|
29115
29123
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
29116
|
-
res += `${
|
|
29124
|
+
res += `${join55}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
29117
29125
|
}
|
|
29118
29126
|
if (spacer !== "") {
|
|
29119
29127
|
res += `
|
|
@@ -29126,7 +29134,7 @@ ${originalIndentation}`;
|
|
|
29126
29134
|
let whitespace = "";
|
|
29127
29135
|
if (spacer !== "") {
|
|
29128
29136
|
indentation += spacer;
|
|
29129
|
-
|
|
29137
|
+
join55 = `,
|
|
29130
29138
|
${indentation}`;
|
|
29131
29139
|
whitespace = " ";
|
|
29132
29140
|
}
|
|
@@ -29135,7 +29143,7 @@ ${indentation}`;
|
|
|
29135
29143
|
const tmp = stringifyArrayReplacer(key2, value[key2], stack, replacer, spacer, indentation);
|
|
29136
29144
|
if (tmp !== void 0) {
|
|
29137
29145
|
res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
|
|
29138
|
-
separator =
|
|
29146
|
+
separator = join55;
|
|
29139
29147
|
}
|
|
29140
29148
|
}
|
|
29141
29149
|
if (spacer !== "" && separator.length > 1) {
|
|
@@ -29193,20 +29201,20 @@ ${originalIndentation}`;
|
|
|
29193
29201
|
indentation += spacer;
|
|
29194
29202
|
let res2 = `
|
|
29195
29203
|
${indentation}`;
|
|
29196
|
-
const
|
|
29204
|
+
const join56 = `,
|
|
29197
29205
|
${indentation}`;
|
|
29198
29206
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
29199
29207
|
let i = 0;
|
|
29200
29208
|
for (; i < maximumValuesToStringify - 1; i++) {
|
|
29201
29209
|
const tmp2 = stringifyIndent(String(i), value[i], stack, spacer, indentation);
|
|
29202
29210
|
res2 += tmp2 !== void 0 ? tmp2 : "null";
|
|
29203
|
-
res2 +=
|
|
29211
|
+
res2 += join56;
|
|
29204
29212
|
}
|
|
29205
29213
|
const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation);
|
|
29206
29214
|
res2 += tmp !== void 0 ? tmp : "null";
|
|
29207
29215
|
if (value.length - 1 > maximumBreadth) {
|
|
29208
29216
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
29209
|
-
res2 += `${
|
|
29217
|
+
res2 += `${join56}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
29210
29218
|
}
|
|
29211
29219
|
res2 += `
|
|
29212
29220
|
${originalIndentation}`;
|
|
@@ -29222,16 +29230,16 @@ ${originalIndentation}`;
|
|
|
29222
29230
|
return '"[Object]"';
|
|
29223
29231
|
}
|
|
29224
29232
|
indentation += spacer;
|
|
29225
|
-
const
|
|
29233
|
+
const join55 = `,
|
|
29226
29234
|
${indentation}`;
|
|
29227
29235
|
let res = "";
|
|
29228
29236
|
let separator = "";
|
|
29229
29237
|
let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
|
|
29230
29238
|
if (isTypedArrayWithEntries(value)) {
|
|
29231
|
-
res += stringifyTypedArray(value,
|
|
29239
|
+
res += stringifyTypedArray(value, join55, maximumBreadth);
|
|
29232
29240
|
keys = keys.slice(value.length);
|
|
29233
29241
|
maximumPropertiesToStringify -= value.length;
|
|
29234
|
-
separator =
|
|
29242
|
+
separator = join55;
|
|
29235
29243
|
}
|
|
29236
29244
|
if (deterministic) {
|
|
29237
29245
|
keys = sort(keys, comparator);
|
|
@@ -29242,13 +29250,13 @@ ${indentation}`;
|
|
|
29242
29250
|
const tmp = stringifyIndent(key2, value[key2], stack, spacer, indentation);
|
|
29243
29251
|
if (tmp !== void 0) {
|
|
29244
29252
|
res += `${separator}${strEscape(key2)}: ${tmp}`;
|
|
29245
|
-
separator =
|
|
29253
|
+
separator = join55;
|
|
29246
29254
|
}
|
|
29247
29255
|
}
|
|
29248
29256
|
if (keyLength > maximumBreadth) {
|
|
29249
29257
|
const removedKeys = keyLength - maximumBreadth;
|
|
29250
29258
|
res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
|
|
29251
|
-
separator =
|
|
29259
|
+
separator = join55;
|
|
29252
29260
|
}
|
|
29253
29261
|
if (separator !== "") {
|
|
29254
29262
|
res = `
|
|
@@ -41744,24 +41752,24 @@ var require_fast_uri = __commonJS({
|
|
|
41744
41752
|
function normalize(uri, options) {
|
|
41745
41753
|
if (typeof uri === "string") {
|
|
41746
41754
|
uri = /** @type {T} */
|
|
41747
|
-
serialize(
|
|
41755
|
+
serialize(parse5(uri, options), options);
|
|
41748
41756
|
} else if (typeof uri === "object") {
|
|
41749
41757
|
uri = /** @type {T} */
|
|
41750
|
-
|
|
41758
|
+
parse5(serialize(uri, options), options);
|
|
41751
41759
|
}
|
|
41752
41760
|
return uri;
|
|
41753
41761
|
}
|
|
41754
41762
|
function resolve11(baseURI, relativeURI, options) {
|
|
41755
41763
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
41756
|
-
const resolved = resolveComponent(
|
|
41764
|
+
const resolved = resolveComponent(parse5(baseURI, schemelessOptions), parse5(relativeURI, schemelessOptions), schemelessOptions, true);
|
|
41757
41765
|
schemelessOptions.skipEscape = true;
|
|
41758
41766
|
return serialize(resolved, schemelessOptions);
|
|
41759
41767
|
}
|
|
41760
41768
|
function resolveComponent(base, relative10, options, skipNormalization) {
|
|
41761
41769
|
const target = {};
|
|
41762
41770
|
if (!skipNormalization) {
|
|
41763
|
-
base =
|
|
41764
|
-
relative10 =
|
|
41771
|
+
base = parse5(serialize(base, options), options);
|
|
41772
|
+
relative10 = parse5(serialize(relative10, options), options);
|
|
41765
41773
|
}
|
|
41766
41774
|
options = options || {};
|
|
41767
41775
|
if (!options.tolerant && relative10.scheme) {
|
|
@@ -41813,13 +41821,13 @@ var require_fast_uri = __commonJS({
|
|
|
41813
41821
|
function equal(uriA, uriB, options) {
|
|
41814
41822
|
if (typeof uriA === "string") {
|
|
41815
41823
|
uriA = unescape(uriA);
|
|
41816
|
-
uriA = serialize(normalizeComponentEncoding(
|
|
41824
|
+
uriA = serialize(normalizeComponentEncoding(parse5(uriA, options), true), { ...options, skipEscape: true });
|
|
41817
41825
|
} else if (typeof uriA === "object") {
|
|
41818
41826
|
uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true });
|
|
41819
41827
|
}
|
|
41820
41828
|
if (typeof uriB === "string") {
|
|
41821
41829
|
uriB = unescape(uriB);
|
|
41822
|
-
uriB = serialize(normalizeComponentEncoding(
|
|
41830
|
+
uriB = serialize(normalizeComponentEncoding(parse5(uriB, options), true), { ...options, skipEscape: true });
|
|
41823
41831
|
} else if (typeof uriB === "object") {
|
|
41824
41832
|
uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true });
|
|
41825
41833
|
}
|
|
@@ -41888,7 +41896,7 @@ var require_fast_uri = __commonJS({
|
|
|
41888
41896
|
return uriTokens.join("");
|
|
41889
41897
|
}
|
|
41890
41898
|
var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
|
|
41891
|
-
function
|
|
41899
|
+
function parse5(uri, opts) {
|
|
41892
41900
|
const options = Object.assign({}, opts);
|
|
41893
41901
|
const parsed = {
|
|
41894
41902
|
scheme: void 0,
|
|
@@ -41982,7 +41990,7 @@ var require_fast_uri = __commonJS({
|
|
|
41982
41990
|
resolveComponent,
|
|
41983
41991
|
equal,
|
|
41984
41992
|
serialize,
|
|
41985
|
-
parse:
|
|
41993
|
+
parse: parse5
|
|
41986
41994
|
};
|
|
41987
41995
|
module2.exports = fastUri;
|
|
41988
41996
|
module2.exports.default = fastUri;
|
|
@@ -46519,11 +46527,11 @@ function createApprovedConfigCommand() {
|
|
|
46519
46527
|
const spinner = options.json ? null : ora(`Fetching approved config for "${org}"...`).start();
|
|
46520
46528
|
try {
|
|
46521
46529
|
let findMdFiles2 = function(dir) {
|
|
46522
|
-
if (!
|
|
46530
|
+
if (!existsSync51(dir)) return [];
|
|
46523
46531
|
const entries = readdirSync19(dir, { withFileTypes: true });
|
|
46524
46532
|
const files = [];
|
|
46525
46533
|
for (const entry of entries) {
|
|
46526
|
-
const fullPath =
|
|
46534
|
+
const fullPath = join55(dir, entry.name);
|
|
46527
46535
|
if (entry.isDirectory()) files.push(...findMdFiles2(fullPath));
|
|
46528
46536
|
else if (entry.name.endsWith(".md")) files.push(fullPath);
|
|
46529
46537
|
}
|
|
@@ -46541,11 +46549,11 @@ function createApprovedConfigCommand() {
|
|
|
46541
46549
|
}
|
|
46542
46550
|
return;
|
|
46543
46551
|
}
|
|
46544
|
-
const { existsSync:
|
|
46545
|
-
const { join:
|
|
46552
|
+
const { existsSync: existsSync51, readdirSync: readdirSync19, readFileSync: readFileSync45 } = await import("fs");
|
|
46553
|
+
const { join: join55, relative: relative10, basename: basename9 } = await import("path");
|
|
46546
46554
|
const baseDir = options.dir || process.cwd();
|
|
46547
|
-
const commandsDir =
|
|
46548
|
-
const agentsDir =
|
|
46555
|
+
const commandsDir = join55(baseDir, ".claude", "commands");
|
|
46556
|
+
const agentsDir = join55(baseDir, ".claude", "agents");
|
|
46549
46557
|
const localCommandNames = findMdFiles2(commandsDir).map(
|
|
46550
46558
|
(f) => relative10(commandsDir, f).replace(/\.md$/, "").replace(/\//g, ":")
|
|
46551
46559
|
);
|
|
@@ -49712,6 +49720,69 @@ var init_sync_initialization = __esm({
|
|
|
49712
49720
|
}
|
|
49713
49721
|
});
|
|
49714
49722
|
|
|
49723
|
+
// src/utils/git-utils.ts
|
|
49724
|
+
function isGitInstalled() {
|
|
49725
|
+
if (cachedGitInstalled !== null) {
|
|
49726
|
+
return cachedGitInstalled;
|
|
49727
|
+
}
|
|
49728
|
+
try {
|
|
49729
|
+
(0, import_child_process8.execSync)("git --version", { stdio: "ignore", timeout: 5e3 });
|
|
49730
|
+
cachedGitInstalled = true;
|
|
49731
|
+
} catch {
|
|
49732
|
+
cachedGitInstalled = false;
|
|
49733
|
+
}
|
|
49734
|
+
return cachedGitInstalled;
|
|
49735
|
+
}
|
|
49736
|
+
function findGitRepoRoot(startPath = process.cwd()) {
|
|
49737
|
+
let currentPath = startPath;
|
|
49738
|
+
const root = (0, import_path23.parse)(currentPath).root;
|
|
49739
|
+
while (currentPath !== root) {
|
|
49740
|
+
const gitPath = (0, import_path23.join)(currentPath, ".git");
|
|
49741
|
+
if ((0, import_fs24.existsSync)(gitPath)) {
|
|
49742
|
+
return currentPath;
|
|
49743
|
+
}
|
|
49744
|
+
currentPath = (0, import_path23.dirname)(currentPath);
|
|
49745
|
+
}
|
|
49746
|
+
if ((0, import_fs24.existsSync)((0, import_path23.join)(root, ".git"))) {
|
|
49747
|
+
return root;
|
|
49748
|
+
}
|
|
49749
|
+
return null;
|
|
49750
|
+
}
|
|
49751
|
+
function checkGitConflict(filePath, repoRoot) {
|
|
49752
|
+
if (!repoRoot || !isGitInstalled()) {
|
|
49753
|
+
return "no-git";
|
|
49754
|
+
}
|
|
49755
|
+
try {
|
|
49756
|
+
(0, import_child_process8.execFileSync)("git", ["ls-files", "--error-unmatch", filePath], {
|
|
49757
|
+
cwd: repoRoot,
|
|
49758
|
+
stdio: "pipe",
|
|
49759
|
+
timeout: 5e3
|
|
49760
|
+
});
|
|
49761
|
+
try {
|
|
49762
|
+
(0, import_child_process8.execFileSync)("git", ["diff", "--quiet", "HEAD", "--", filePath], {
|
|
49763
|
+
cwd: repoRoot,
|
|
49764
|
+
stdio: "pipe",
|
|
49765
|
+
timeout: 5e3
|
|
49766
|
+
});
|
|
49767
|
+
return "tracked-clean";
|
|
49768
|
+
} catch {
|
|
49769
|
+
return "tracked-modified";
|
|
49770
|
+
}
|
|
49771
|
+
} catch {
|
|
49772
|
+
return "untracked";
|
|
49773
|
+
}
|
|
49774
|
+
}
|
|
49775
|
+
var import_child_process8, import_fs24, import_path23, cachedGitInstalled;
|
|
49776
|
+
var init_git_utils = __esm({
|
|
49777
|
+
"src/utils/git-utils.ts"() {
|
|
49778
|
+
"use strict";
|
|
49779
|
+
import_child_process8 = require("child_process");
|
|
49780
|
+
import_fs24 = require("fs");
|
|
49781
|
+
import_path23 = require("path");
|
|
49782
|
+
cachedGitInstalled = null;
|
|
49783
|
+
}
|
|
49784
|
+
});
|
|
49785
|
+
|
|
49715
49786
|
// src/utils/drift-check.ts
|
|
49716
49787
|
var drift_check_exports = {};
|
|
49717
49788
|
__export(drift_check_exports, {
|
|
@@ -49725,12 +49796,12 @@ function hashContent(content) {
|
|
|
49725
49796
|
return (0, import_crypto5.createHash)("sha256").update(content).digest("hex").substring(0, 16);
|
|
49726
49797
|
}
|
|
49727
49798
|
function getUserSettingsPath() {
|
|
49728
|
-
return (0,
|
|
49799
|
+
return (0, import_path24.join)((0, import_os18.homedir)(), ".claude", "settings.json");
|
|
49729
49800
|
}
|
|
49730
49801
|
function readLocalSettings(settingsPath) {
|
|
49731
|
-
if (!(0,
|
|
49802
|
+
if (!(0, import_fs25.existsSync)(settingsPath)) return null;
|
|
49732
49803
|
try {
|
|
49733
|
-
return (0,
|
|
49804
|
+
return (0, import_fs25.readFileSync)(settingsPath, "utf-8");
|
|
49734
49805
|
} catch {
|
|
49735
49806
|
return null;
|
|
49736
49807
|
}
|
|
@@ -49790,10 +49861,10 @@ function printDriftWarning(result) {
|
|
|
49790
49861
|
console.log();
|
|
49791
49862
|
}
|
|
49792
49863
|
async function runSessionDriftCheck(projectRoot) {
|
|
49793
|
-
const syncStatePath = (0,
|
|
49794
|
-
if (!(0,
|
|
49864
|
+
const syncStatePath = (0, import_path24.join)(projectRoot, ".gal", "sync-state.json");
|
|
49865
|
+
if (!(0, import_fs25.existsSync)(syncStatePath)) return null;
|
|
49795
49866
|
try {
|
|
49796
|
-
const stateContent = (0,
|
|
49867
|
+
const stateContent = (0, import_fs25.readFileSync)(syncStatePath, "utf-8");
|
|
49797
49868
|
const state = JSON.parse(stateContent);
|
|
49798
49869
|
const claudeState = state.platforms?.claude;
|
|
49799
49870
|
const orgHash = claudeState?.lastSyncHash || state.lastSyncHash || null;
|
|
@@ -49823,12 +49894,12 @@ async function runSessionDriftCheck(projectRoot) {
|
|
|
49823
49894
|
return null;
|
|
49824
49895
|
}
|
|
49825
49896
|
}
|
|
49826
|
-
var
|
|
49897
|
+
var import_fs25, import_path24, import_os18, import_crypto5;
|
|
49827
49898
|
var init_drift_check = __esm({
|
|
49828
49899
|
"src/utils/drift-check.ts"() {
|
|
49829
49900
|
"use strict";
|
|
49830
|
-
|
|
49831
|
-
|
|
49901
|
+
import_fs25 = require("fs");
|
|
49902
|
+
import_path24 = require("path");
|
|
49832
49903
|
import_os18 = require("os");
|
|
49833
49904
|
import_crypto5 = require("crypto");
|
|
49834
49905
|
init_source();
|
|
@@ -49841,30 +49912,30 @@ function countEnabledDispatchCategories(categories) {
|
|
|
49841
49912
|
return getValidDispatchCategories(categories).filter((category) => category.enabled).length;
|
|
49842
49913
|
}
|
|
49843
49914
|
function installCursorGalCliRules(directory) {
|
|
49844
|
-
const cursorRulesDir = (0,
|
|
49845
|
-
const rulesPath = (0,
|
|
49915
|
+
const cursorRulesDir = (0, import_path25.join)(directory, ".cursor", "rules", "gal-cli");
|
|
49916
|
+
const rulesPath = (0, import_path25.join)(cursorRulesDir, "RULE.md");
|
|
49846
49917
|
try {
|
|
49847
|
-
if ((0,
|
|
49848
|
-
const existingContent = (0,
|
|
49918
|
+
if ((0, import_fs26.existsSync)(rulesPath)) {
|
|
49919
|
+
const existingContent = (0, import_fs26.readFileSync)(rulesPath, "utf-8");
|
|
49849
49920
|
const versionMatch = existingContent.match(/GAL_CURSOR_RULES_VERSION = "([^"]+)"/);
|
|
49850
49921
|
if (versionMatch && versionMatch[1] === GAL_CLI_CURSOR_RULES_VERSION) {
|
|
49851
49922
|
return true;
|
|
49852
49923
|
}
|
|
49853
49924
|
}
|
|
49854
|
-
if (!(0,
|
|
49855
|
-
(0,
|
|
49925
|
+
if (!(0, import_fs26.existsSync)(cursorRulesDir)) {
|
|
49926
|
+
(0, import_fs26.mkdirSync)(cursorRulesDir, { recursive: true });
|
|
49856
49927
|
}
|
|
49857
|
-
(0,
|
|
49928
|
+
(0, import_fs26.writeFileSync)(rulesPath, GAL_CLI_CURSOR_RULES, "utf-8");
|
|
49858
49929
|
return true;
|
|
49859
49930
|
} catch {
|
|
49860
49931
|
return false;
|
|
49861
49932
|
}
|
|
49862
49933
|
}
|
|
49863
49934
|
function writeSyncStateV2(orgName, platformStates, hookSettings) {
|
|
49864
|
-
const galDir = (0,
|
|
49865
|
-
const statePath = (0,
|
|
49866
|
-
if (!(0,
|
|
49867
|
-
(0,
|
|
49935
|
+
const galDir = (0, import_path25.join)(process.cwd(), ".gal");
|
|
49936
|
+
const statePath = (0, import_path25.join)(galDir, "sync-state.json");
|
|
49937
|
+
if (!(0, import_fs26.existsSync)(galDir)) {
|
|
49938
|
+
(0, import_fs26.mkdirSync)(galDir, { recursive: true });
|
|
49868
49939
|
}
|
|
49869
49940
|
const platforms = {};
|
|
49870
49941
|
for (const [platform5, state2] of platformStates) {
|
|
@@ -49885,7 +49956,7 @@ function writeSyncStateV2(orgName, platformStates, hookSettings) {
|
|
|
49885
49956
|
// After a successful sync, approved hash matches local hash
|
|
49886
49957
|
approvedConfigHash: primaryState?.lastSyncHash
|
|
49887
49958
|
};
|
|
49888
|
-
(0,
|
|
49959
|
+
(0, import_fs26.writeFileSync)(statePath, JSON.stringify(state, null, 2), "utf-8");
|
|
49889
49960
|
}
|
|
49890
49961
|
function writeSyncState(orgName, localHash, approvedHash, version2, syncedFiles = [], policyName, hookSettings) {
|
|
49891
49962
|
const platformStates = /* @__PURE__ */ new Map();
|
|
@@ -49941,16 +50012,16 @@ function findChangedKeys(existing, incoming, prefix = "") {
|
|
|
49941
50012
|
}
|
|
49942
50013
|
function readSyncState() {
|
|
49943
50014
|
const projectRoot = findProjectRoot();
|
|
49944
|
-
const statePath = (0,
|
|
49945
|
-
if (!(0,
|
|
50015
|
+
const statePath = (0, import_path25.join)(projectRoot, ".gal", "sync-state.json");
|
|
50016
|
+
if (!(0, import_fs26.existsSync)(statePath)) {
|
|
49946
50017
|
return null;
|
|
49947
50018
|
}
|
|
49948
50019
|
try {
|
|
49949
|
-
const content = (0,
|
|
50020
|
+
const content = (0, import_fs26.readFileSync)(statePath, "utf-8");
|
|
49950
50021
|
const rawState = JSON.parse(content);
|
|
49951
50022
|
if (!rawState.schemaVersion) {
|
|
49952
50023
|
const migratedState = migrateSyncStateV1ToV2(rawState);
|
|
49953
|
-
(0,
|
|
50024
|
+
(0, import_fs26.writeFileSync)(statePath, JSON.stringify(migratedState, null, 2), "utf-8");
|
|
49954
50025
|
return migratedState;
|
|
49955
50026
|
}
|
|
49956
50027
|
return rawState;
|
|
@@ -50123,8 +50194,8 @@ async function pushLearnings(directory, orgName, apiUrl, headers, options) {
|
|
|
50123
50194
|
let repoSlug;
|
|
50124
50195
|
let sessionId = process.env.CLAUDE_SESSION_ID || `cli-${Date.now()}`;
|
|
50125
50196
|
try {
|
|
50126
|
-
const { execSync:
|
|
50127
|
-
const remoteUrl =
|
|
50197
|
+
const { execSync: execSync15 } = await import("child_process");
|
|
50198
|
+
const remoteUrl = execSync15("git remote get-url origin", { cwd: directory, encoding: "utf-8" }).trim();
|
|
50128
50199
|
const match = remoteUrl.match(/github\.com[:/]([^/]+\/[^/]+?)(\.git)?$/);
|
|
50129
50200
|
if (match) {
|
|
50130
50201
|
repoSlug = match[1];
|
|
@@ -50132,32 +50203,32 @@ async function pushLearnings(directory, orgName, apiUrl, headers, options) {
|
|
|
50132
50203
|
} catch {
|
|
50133
50204
|
}
|
|
50134
50205
|
const learningFiles = [];
|
|
50135
|
-
const claudeMdPath = (0,
|
|
50136
|
-
if ((0,
|
|
50206
|
+
const claudeMdPath = (0, import_path25.join)(directory, ".claude", "CLAUDE.md");
|
|
50207
|
+
if ((0, import_fs26.existsSync)(claudeMdPath)) {
|
|
50137
50208
|
learningFiles.push({ path: claudeMdPath, type: "instruction" });
|
|
50138
50209
|
}
|
|
50139
|
-
const rootClaudeMdPath = (0,
|
|
50140
|
-
if ((0,
|
|
50210
|
+
const rootClaudeMdPath = (0, import_path25.join)(directory, "CLAUDE.md");
|
|
50211
|
+
if ((0, import_fs26.existsSync)(rootClaudeMdPath)) {
|
|
50141
50212
|
learningFiles.push({ path: rootClaudeMdPath, type: "memory" });
|
|
50142
50213
|
}
|
|
50143
|
-
const rulesDir = (0,
|
|
50144
|
-
if ((0,
|
|
50145
|
-
const ruleFiles = (0,
|
|
50214
|
+
const rulesDir = (0, import_path25.join)(directory, ".claude", "rules");
|
|
50215
|
+
if ((0, import_fs26.existsSync)(rulesDir)) {
|
|
50216
|
+
const ruleFiles = (0, import_fs26.readdirSync)(rulesDir).filter((f) => f.endsWith(".md"));
|
|
50146
50217
|
for (const file of ruleFiles) {
|
|
50147
|
-
learningFiles.push({ path: (0,
|
|
50218
|
+
learningFiles.push({ path: (0, import_path25.join)(rulesDir, file), type: "instruction" });
|
|
50148
50219
|
}
|
|
50149
50220
|
}
|
|
50150
|
-
const commandsDir = (0,
|
|
50151
|
-
if ((0,
|
|
50152
|
-
const cmdFiles = (0,
|
|
50221
|
+
const commandsDir = (0, import_path25.join)(directory, ".claude", "commands");
|
|
50222
|
+
if ((0, import_fs26.existsSync)(commandsDir)) {
|
|
50223
|
+
const cmdFiles = (0, import_fs26.readdirSync)(commandsDir).filter((f) => f.endsWith(".md"));
|
|
50153
50224
|
for (const file of cmdFiles) {
|
|
50154
|
-
learningFiles.push({ path: (0,
|
|
50225
|
+
learningFiles.push({ path: (0, import_path25.join)(commandsDir, file), type: "command" });
|
|
50155
50226
|
}
|
|
50156
50227
|
}
|
|
50157
50228
|
spinner.text = `Found ${learningFiles.length} source files, extracting learnings...`;
|
|
50158
50229
|
const learnings = [];
|
|
50159
50230
|
for (const { path: path8, type } of learningFiles) {
|
|
50160
|
-
const content = (0,
|
|
50231
|
+
const content = (0, import_fs26.readFileSync)(path8, "utf-8");
|
|
50161
50232
|
const relPath = path8.replace(directory + "/", "");
|
|
50162
50233
|
const learningPattern = /^##\s+(.*(?:Learning|Anti-pattern|Best Practice|CRITICAL).*?)$/i;
|
|
50163
50234
|
const hasLearnings = content.match(new RegExp(learningPattern.source, "im"));
|
|
@@ -50403,7 +50474,7 @@ function createSyncCommand() {
|
|
|
50403
50474
|
}
|
|
50404
50475
|
console.log();
|
|
50405
50476
|
});
|
|
50406
|
-
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) => {
|
|
50477
|
+
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("--force", "Overwrite git-tracked files even if they have local modifications (#5068)").option("--target <target>", "Sync specific target: configs (default), domains (domain allowlist)").action(async (orgName, options) => {
|
|
50407
50478
|
try {
|
|
50408
50479
|
const directory = findProjectRoot(options.directory);
|
|
50409
50480
|
if (options.pull && options.auto && !shouldRunAutoSync(directory, options.directory || process.cwd())) {
|
|
@@ -50452,30 +50523,30 @@ function createSyncCommand() {
|
|
|
50452
50523
|
}
|
|
50453
50524
|
const allowlist = await res.json();
|
|
50454
50525
|
spinner2.succeed(source_default.green("Domain allowlist fetched"));
|
|
50455
|
-
const galDir = (0,
|
|
50456
|
-
if (!(0,
|
|
50457
|
-
(0,
|
|
50526
|
+
const galDir = (0, import_path25.join)(directory, ".gal");
|
|
50527
|
+
if (!(0, import_fs26.existsSync)(galDir)) {
|
|
50528
|
+
(0, import_fs26.mkdirSync)(galDir, { recursive: true });
|
|
50458
50529
|
}
|
|
50459
|
-
const allowlistPath = (0,
|
|
50460
|
-
(0,
|
|
50530
|
+
const allowlistPath = (0, import_path25.join)(galDir, "domain-allowlist.json");
|
|
50531
|
+
(0, import_fs26.writeFileSync)(allowlistPath, JSON.stringify(allowlist, null, 2) + "\n", "utf-8");
|
|
50461
50532
|
console.log(source_default.green(`
|
|
50462
50533
|
Synced domain allowlist to .gal/domain-allowlist.json`));
|
|
50463
50534
|
console.log(source_default.dim(` Domains: ${allowlist.allowedDomains?.length || 0}`));
|
|
50464
50535
|
console.log(source_default.dim(` MCP endpoints: ${allowlist.allowedMcpEndpoints?.length || 0}`));
|
|
50465
50536
|
console.log(source_default.dim(` Enforced: ${allowlist.enforced ? "yes" : "no (audit-only)"}`));
|
|
50466
|
-
const policiesDir = (0,
|
|
50467
|
-
if ((0,
|
|
50468
|
-
if (!(0,
|
|
50469
|
-
(0,
|
|
50537
|
+
const policiesDir = (0, import_path25.join)(directory, ".github", "policies");
|
|
50538
|
+
if ((0, import_fs26.existsSync)((0, import_path25.join)(directory, ".github"))) {
|
|
50539
|
+
if (!(0, import_fs26.existsSync)(policiesDir)) {
|
|
50540
|
+
(0, import_fs26.mkdirSync)(policiesDir, { recursive: true });
|
|
50470
50541
|
}
|
|
50471
|
-
const policyPath = (0,
|
|
50542
|
+
const policyPath = (0, import_path25.join)(policiesDir, "domain-allowlist.json");
|
|
50472
50543
|
const policyContent = {
|
|
50473
50544
|
version: allowlist.version || 1,
|
|
50474
50545
|
approvedDomains: allowlist.allowedDomains || [],
|
|
50475
50546
|
approvedMcpEndpoints: allowlist.allowedMcpEndpoints || [],
|
|
50476
50547
|
description: "Domains approved for AI agent WebFetch/WebSearch access. Managed by GAL org-level policy."
|
|
50477
50548
|
};
|
|
50478
|
-
(0,
|
|
50549
|
+
(0, import_fs26.writeFileSync)(policyPath, JSON.stringify(policyContent, null, 2) + "\n", "utf-8");
|
|
50479
50550
|
console.log(source_default.dim(` Also updated .github/policies/domain-allowlist.json`));
|
|
50480
50551
|
}
|
|
50481
50552
|
console.log();
|
|
@@ -50690,7 +50761,9 @@ function createSyncCommand() {
|
|
|
50690
50761
|
process.exit(1);
|
|
50691
50762
|
}
|
|
50692
50763
|
if (options.pull) {
|
|
50693
|
-
await pullApprovedConfig(configRepo, authRepo, org, directory, options.platform, apiUrl
|
|
50764
|
+
await pullApprovedConfig(configRepo, authRepo, org, directory, options.platform, apiUrl, {
|
|
50765
|
+
force: options.force ?? false
|
|
50766
|
+
});
|
|
50694
50767
|
process.exit(0);
|
|
50695
50768
|
}
|
|
50696
50769
|
if (options.check) {
|
|
@@ -50822,11 +50895,11 @@ function createSyncCommand() {
|
|
|
50822
50895
|
process.exit(0);
|
|
50823
50896
|
}
|
|
50824
50897
|
const directory = findProjectRoot(settingsOpts.directory || process.cwd());
|
|
50825
|
-
const settingsPath = (0,
|
|
50898
|
+
const settingsPath = (0, import_path25.join)(directory, ".claude", "settings.json");
|
|
50826
50899
|
let existingSettings = {};
|
|
50827
|
-
if ((0,
|
|
50900
|
+
if ((0, import_fs26.existsSync)(settingsPath)) {
|
|
50828
50901
|
try {
|
|
50829
|
-
existingSettings = JSON.parse((0,
|
|
50902
|
+
existingSettings = JSON.parse((0, import_fs26.readFileSync)(settingsPath, "utf-8"));
|
|
50830
50903
|
} catch {
|
|
50831
50904
|
console.error(source_default.red("Error: Could not parse existing .claude/settings.json"));
|
|
50832
50905
|
process.exit(1);
|
|
@@ -50862,11 +50935,11 @@ function createSyncCommand() {
|
|
|
50862
50935
|
deny: mergedDeny
|
|
50863
50936
|
}
|
|
50864
50937
|
};
|
|
50865
|
-
const claudeDir = (0,
|
|
50866
|
-
if (!(0,
|
|
50867
|
-
(0,
|
|
50938
|
+
const claudeDir = (0, import_path25.join)(directory, ".claude");
|
|
50939
|
+
if (!(0, import_fs26.existsSync)(claudeDir)) {
|
|
50940
|
+
(0, import_fs26.mkdirSync)(claudeDir, { recursive: true });
|
|
50868
50941
|
}
|
|
50869
|
-
(0,
|
|
50942
|
+
(0, import_fs26.writeFileSync)(settingsPath, JSON.stringify(merged, null, 2) + "\n", "utf-8");
|
|
50870
50943
|
console.log(source_default.green(`
|
|
50871
50944
|
\u2714 Added ${added.length} deny rule(s) to ${settingsPath}`));
|
|
50872
50945
|
for (const rule of added) {
|
|
@@ -50885,67 +50958,67 @@ function scanLocalConfigs(directory, platformFilter) {
|
|
|
50885
50958
|
for (const platform5 of platforms) {
|
|
50886
50959
|
if (platformFilter && platform5 !== platformFilter) continue;
|
|
50887
50960
|
const platformDir = getPlatformDirectory(platform5);
|
|
50888
|
-
const fullPath = (0,
|
|
50889
|
-
if (!(0,
|
|
50961
|
+
const fullPath = (0, import_path25.join)(directory, platformDir);
|
|
50962
|
+
if (!(0, import_fs26.existsSync)(fullPath)) continue;
|
|
50890
50963
|
const files = [];
|
|
50891
|
-
const settingsPath = (0,
|
|
50892
|
-
if ((0,
|
|
50964
|
+
const settingsPath = (0, import_path25.join)(fullPath, "settings.json");
|
|
50965
|
+
if ((0, import_fs26.existsSync)(settingsPath)) {
|
|
50893
50966
|
files.push({
|
|
50894
50967
|
path: settingsPath,
|
|
50895
50968
|
type: "settings",
|
|
50896
|
-
content: (0,
|
|
50969
|
+
content: (0, import_fs26.readFileSync)(settingsPath, "utf-8")
|
|
50897
50970
|
});
|
|
50898
50971
|
}
|
|
50899
|
-
const rulesDir = (0,
|
|
50900
|
-
if ((0,
|
|
50901
|
-
const ruleFiles = (0,
|
|
50972
|
+
const rulesDir = (0, import_path25.join)(fullPath, "rules");
|
|
50973
|
+
if ((0, import_fs26.existsSync)(rulesDir)) {
|
|
50974
|
+
const ruleFiles = (0, import_fs26.readdirSync)(rulesDir).filter(
|
|
50902
50975
|
(f) => f.endsWith(".md") || f.endsWith(".mdc")
|
|
50903
50976
|
);
|
|
50904
50977
|
for (const file of ruleFiles) {
|
|
50905
|
-
const filePath = (0,
|
|
50978
|
+
const filePath = (0, import_path25.join)(rulesDir, file);
|
|
50906
50979
|
files.push({
|
|
50907
50980
|
path: filePath,
|
|
50908
50981
|
type: "rule",
|
|
50909
|
-
content: (0,
|
|
50982
|
+
content: (0, import_fs26.readFileSync)(filePath, "utf-8")
|
|
50910
50983
|
});
|
|
50911
50984
|
}
|
|
50912
50985
|
}
|
|
50913
50986
|
if (platform5 === "cursor") {
|
|
50914
|
-
const cursorRulesPath = (0,
|
|
50915
|
-
if ((0,
|
|
50987
|
+
const cursorRulesPath = (0, import_path25.join)(directory, ".cursorrules");
|
|
50988
|
+
if ((0, import_fs26.existsSync)(cursorRulesPath)) {
|
|
50916
50989
|
files.push({
|
|
50917
50990
|
path: cursorRulesPath,
|
|
50918
50991
|
type: "rule",
|
|
50919
|
-
content: (0,
|
|
50992
|
+
content: (0, import_fs26.readFileSync)(cursorRulesPath, "utf-8")
|
|
50920
50993
|
});
|
|
50921
50994
|
}
|
|
50922
50995
|
}
|
|
50923
50996
|
if (platform5 === "claude") {
|
|
50924
|
-
const commandsDir = (0,
|
|
50925
|
-
if ((0,
|
|
50926
|
-
const commandFiles = (0,
|
|
50997
|
+
const commandsDir = (0, import_path25.join)(fullPath, "commands");
|
|
50998
|
+
if ((0, import_fs26.existsSync)(commandsDir)) {
|
|
50999
|
+
const commandFiles = (0, import_fs26.readdirSync)(commandsDir).filter(
|
|
50927
51000
|
(f) => f.endsWith(".md")
|
|
50928
51001
|
);
|
|
50929
51002
|
for (const file of commandFiles) {
|
|
50930
|
-
const filePath = (0,
|
|
51003
|
+
const filePath = (0, import_path25.join)(commandsDir, file);
|
|
50931
51004
|
files.push({
|
|
50932
51005
|
path: filePath,
|
|
50933
51006
|
type: "command",
|
|
50934
|
-
content: (0,
|
|
51007
|
+
content: (0, import_fs26.readFileSync)(filePath, "utf-8")
|
|
50935
51008
|
});
|
|
50936
51009
|
}
|
|
50937
51010
|
}
|
|
50938
|
-
const hooksDir = (0,
|
|
50939
|
-
if ((0,
|
|
50940
|
-
const hookFiles = (0,
|
|
51011
|
+
const hooksDir = (0, import_path25.join)(fullPath, "hooks");
|
|
51012
|
+
if ((0, import_fs26.existsSync)(hooksDir)) {
|
|
51013
|
+
const hookFiles = (0, import_fs26.readdirSync)(hooksDir).filter(
|
|
50941
51014
|
(f) => f.endsWith(".py") || f.endsWith(".sh")
|
|
50942
51015
|
);
|
|
50943
51016
|
for (const file of hookFiles) {
|
|
50944
|
-
const filePath = (0,
|
|
51017
|
+
const filePath = (0, import_path25.join)(hooksDir, file);
|
|
50945
51018
|
files.push({
|
|
50946
51019
|
path: filePath,
|
|
50947
51020
|
type: "hook",
|
|
50948
|
-
content: (0,
|
|
51021
|
+
content: (0, import_fs26.readFileSync)(filePath, "utf-8")
|
|
50949
51022
|
});
|
|
50950
51023
|
}
|
|
50951
51024
|
}
|
|
@@ -51058,16 +51131,16 @@ Sync Status for ${orgName}:
|
|
|
51058
51131
|
}
|
|
51059
51132
|
}
|
|
51060
51133
|
function writeCursorConfig(directory, configData, syncedFiles, syncedItems) {
|
|
51061
|
-
const cursorDir = (0,
|
|
51134
|
+
const cursorDir = (0, import_path25.join)(directory, ".cursor");
|
|
51062
51135
|
if (configData.rules && configData.rules.length > 0) {
|
|
51063
|
-
const rulesDir = (0,
|
|
51064
|
-
if (!(0,
|
|
51065
|
-
(0,
|
|
51136
|
+
const rulesDir = (0, import_path25.join)(cursorDir, "rules");
|
|
51137
|
+
if (!(0, import_fs26.existsSync)(rulesDir)) {
|
|
51138
|
+
(0, import_fs26.mkdirSync)(rulesDir, { recursive: true });
|
|
51066
51139
|
}
|
|
51067
51140
|
for (const rule of configData.rules) {
|
|
51068
51141
|
const fileName = rule.name.endsWith(".mdc") || rule.name.endsWith(".md") ? rule.name : `${rule.name}.mdc`;
|
|
51069
|
-
const filePath = (0,
|
|
51070
|
-
(0,
|
|
51142
|
+
const filePath = (0, import_path25.join)(rulesDir, fileName);
|
|
51143
|
+
(0, import_fs26.writeFileSync)(filePath, rule.content, "utf-8");
|
|
51071
51144
|
const relativePath = `.cursor/rules/${fileName}`;
|
|
51072
51145
|
syncedFiles.push(relativePath);
|
|
51073
51146
|
syncedItems.push({
|
|
@@ -51079,8 +51152,8 @@ function writeCursorConfig(directory, configData, syncedFiles, syncedItems) {
|
|
|
51079
51152
|
}
|
|
51080
51153
|
}
|
|
51081
51154
|
if (configData.cursorRules?.content) {
|
|
51082
|
-
const cursorRulesPath = (0,
|
|
51083
|
-
(0,
|
|
51155
|
+
const cursorRulesPath = (0, import_path25.join)(directory, ".cursorrules");
|
|
51156
|
+
(0, import_fs26.writeFileSync)(cursorRulesPath, configData.cursorRules.content, "utf-8");
|
|
51084
51157
|
syncedFiles.push(".cursorrules");
|
|
51085
51158
|
syncedItems.push({
|
|
51086
51159
|
path: ".cursorrules",
|
|
@@ -51090,11 +51163,11 @@ function writeCursorConfig(directory, configData, syncedFiles, syncedItems) {
|
|
|
51090
51163
|
});
|
|
51091
51164
|
}
|
|
51092
51165
|
if (configData.settings?.content) {
|
|
51093
|
-
if (!(0,
|
|
51094
|
-
(0,
|
|
51166
|
+
if (!(0, import_fs26.existsSync)(cursorDir)) {
|
|
51167
|
+
(0, import_fs26.mkdirSync)(cursorDir, { recursive: true });
|
|
51095
51168
|
}
|
|
51096
|
-
const settingsPath = (0,
|
|
51097
|
-
(0,
|
|
51169
|
+
const settingsPath = (0, import_path25.join)(cursorDir, "settings.json");
|
|
51170
|
+
(0, import_fs26.writeFileSync)(settingsPath, configData.settings.content, "utf-8");
|
|
51098
51171
|
syncedFiles.push(".cursor/settings.json");
|
|
51099
51172
|
syncedItems.push({
|
|
51100
51173
|
path: ".cursor/settings.json",
|
|
@@ -51104,77 +51177,108 @@ function writeCursorConfig(directory, configData, syncedFiles, syncedItems) {
|
|
|
51104
51177
|
});
|
|
51105
51178
|
}
|
|
51106
51179
|
}
|
|
51107
|
-
function writeClaudeConfig(directory, configData, syncedFiles, syncedItems, orgName) {
|
|
51108
|
-
const claudeDir = (0,
|
|
51180
|
+
function writeClaudeConfig(directory, configData, syncedFiles, syncedItems, orgName, gitRepoRoot, force, conflictFiles) {
|
|
51181
|
+
const claudeDir = (0, import_path25.join)(directory, ".claude");
|
|
51182
|
+
function isSafeToWrite(filePath, relativePath) {
|
|
51183
|
+
if (force) return true;
|
|
51184
|
+
const repoRoot = gitRepoRoot ?? null;
|
|
51185
|
+
const status = checkGitConflict(filePath, repoRoot);
|
|
51186
|
+
if (status === "tracked-modified") {
|
|
51187
|
+
console.log(
|
|
51188
|
+
source_default.yellow(
|
|
51189
|
+
` \u26A0 Skipped (git-tracked, local changes): ${relativePath}`
|
|
51190
|
+
)
|
|
51191
|
+
);
|
|
51192
|
+
console.log(
|
|
51193
|
+
source_default.dim(
|
|
51194
|
+
` Use --force to overwrite. Your local changes were preserved.`
|
|
51195
|
+
)
|
|
51196
|
+
);
|
|
51197
|
+
conflictFiles?.push(relativePath);
|
|
51198
|
+
return false;
|
|
51199
|
+
}
|
|
51200
|
+
if (status === "tracked-clean") {
|
|
51201
|
+
console.log(
|
|
51202
|
+
source_default.dim(` \u2139 Overwriting git-tracked (unmodified) file: ${relativePath}`)
|
|
51203
|
+
);
|
|
51204
|
+
}
|
|
51205
|
+
return true;
|
|
51206
|
+
}
|
|
51109
51207
|
if (configData.instructions?.content) {
|
|
51110
|
-
const claudeMdPath = (0,
|
|
51111
|
-
|
|
51112
|
-
|
|
51113
|
-
|
|
51114
|
-
|
|
51115
|
-
|
|
51116
|
-
|
|
51117
|
-
|
|
51118
|
-
|
|
51208
|
+
const claudeMdPath = (0, import_path25.join)(directory, "CLAUDE.md");
|
|
51209
|
+
if (isSafeToWrite(claudeMdPath, "CLAUDE.md")) {
|
|
51210
|
+
(0, import_fs26.writeFileSync)(claudeMdPath, configData.instructions.content, "utf-8");
|
|
51211
|
+
syncedFiles.push("CLAUDE.md");
|
|
51212
|
+
syncedItems.push({
|
|
51213
|
+
path: "CLAUDE.md",
|
|
51214
|
+
type: "unknown",
|
|
51215
|
+
name: "CLAUDE.md",
|
|
51216
|
+
platform: "claude"
|
|
51217
|
+
});
|
|
51218
|
+
}
|
|
51119
51219
|
}
|
|
51120
51220
|
if (configData.commands && configData.commands.length > 0) {
|
|
51121
|
-
const commandsDir = (0,
|
|
51122
|
-
if (!(0,
|
|
51123
|
-
(0,
|
|
51221
|
+
const commandsDir = (0, import_path25.join)(claudeDir, "commands");
|
|
51222
|
+
if (!(0, import_fs26.existsSync)(commandsDir)) {
|
|
51223
|
+
(0, import_fs26.mkdirSync)(commandsDir, { recursive: true });
|
|
51124
51224
|
}
|
|
51125
51225
|
for (const cmd of configData.commands) {
|
|
51126
51226
|
const pathFromName = cmd.name.replace(/:/g, "/");
|
|
51127
51227
|
const fileName = pathFromName.endsWith(".md") ? pathFromName : `${pathFromName}.md`;
|
|
51128
|
-
const filePath = (0,
|
|
51129
|
-
const fileDir = (0,
|
|
51130
|
-
if (!(0,
|
|
51131
|
-
(0,
|
|
51228
|
+
const filePath = (0, import_path25.join)(commandsDir, fileName);
|
|
51229
|
+
const fileDir = (0, import_path25.dirname)(filePath);
|
|
51230
|
+
if (!(0, import_fs26.existsSync)(fileDir)) {
|
|
51231
|
+
(0, import_fs26.mkdirSync)(fileDir, { recursive: true });
|
|
51132
51232
|
}
|
|
51133
|
-
(0, import_fs25.writeFileSync)(filePath, cmd.content, "utf-8");
|
|
51134
51233
|
const relativePath = `.claude/commands/${fileName}`;
|
|
51135
|
-
|
|
51136
|
-
|
|
51137
|
-
|
|
51138
|
-
|
|
51139
|
-
|
|
51140
|
-
|
|
51141
|
-
|
|
51142
|
-
|
|
51143
|
-
|
|
51144
|
-
|
|
51234
|
+
if (isSafeToWrite(filePath, relativePath)) {
|
|
51235
|
+
(0, import_fs26.writeFileSync)(filePath, cmd.content, "utf-8");
|
|
51236
|
+
syncedFiles.push(relativePath);
|
|
51237
|
+
const { description, allowedTools } = parseCommandFrontmatter(cmd.content);
|
|
51238
|
+
syncedItems.push({
|
|
51239
|
+
path: relativePath,
|
|
51240
|
+
type: "commands",
|
|
51241
|
+
name: cmd.name.replace(/\.md$/, ""),
|
|
51242
|
+
description,
|
|
51243
|
+
allowedTools,
|
|
51244
|
+
platform: "claude"
|
|
51245
|
+
});
|
|
51246
|
+
}
|
|
51145
51247
|
}
|
|
51146
51248
|
}
|
|
51147
51249
|
if (configData.hooks && configData.hooks.length > 0) {
|
|
51148
|
-
const hooksDir = (0,
|
|
51149
|
-
if (!(0,
|
|
51150
|
-
(0,
|
|
51250
|
+
const hooksDir = (0, import_path25.join)(claudeDir, "hooks");
|
|
51251
|
+
if (!(0, import_fs26.existsSync)(hooksDir)) {
|
|
51252
|
+
(0, import_fs26.mkdirSync)(hooksDir, { recursive: true });
|
|
51151
51253
|
}
|
|
51152
51254
|
for (const hook of configData.hooks) {
|
|
51153
|
-
const filePath = (0,
|
|
51154
|
-
(0, import_fs25.writeFileSync)(filePath, hook.content, "utf-8");
|
|
51255
|
+
const filePath = (0, import_path25.join)(hooksDir, hook.name);
|
|
51155
51256
|
const relativePath = `.claude/hooks/${hook.name}`;
|
|
51156
|
-
|
|
51157
|
-
|
|
51158
|
-
|
|
51159
|
-
|
|
51160
|
-
|
|
51161
|
-
|
|
51162
|
-
|
|
51257
|
+
if (isSafeToWrite(filePath, relativePath)) {
|
|
51258
|
+
(0, import_fs26.writeFileSync)(filePath, hook.content, "utf-8");
|
|
51259
|
+
syncedFiles.push(relativePath);
|
|
51260
|
+
syncedItems.push({
|
|
51261
|
+
path: relativePath,
|
|
51262
|
+
type: "hooks",
|
|
51263
|
+
name: hook.name,
|
|
51264
|
+
platform: "claude"
|
|
51265
|
+
});
|
|
51266
|
+
}
|
|
51163
51267
|
}
|
|
51164
51268
|
}
|
|
51165
51269
|
if (configData.settings?.content) {
|
|
51166
|
-
if (!(0,
|
|
51167
|
-
(0,
|
|
51270
|
+
if (!(0, import_fs26.existsSync)(claudeDir)) {
|
|
51271
|
+
(0, import_fs26.mkdirSync)(claudeDir, { recursive: true });
|
|
51168
51272
|
}
|
|
51169
|
-
const settingsPath = (0,
|
|
51170
|
-
if ((0,
|
|
51171
|
-
const existingContent = (0,
|
|
51273
|
+
const settingsPath = (0, import_path25.join)(claudeDir, "settings.json");
|
|
51274
|
+
if ((0, import_fs26.existsSync)(settingsPath)) {
|
|
51275
|
+
const existingContent = (0, import_fs26.readFileSync)(settingsPath, "utf-8");
|
|
51172
51276
|
const newContent = configData.settings.content;
|
|
51173
51277
|
const existingHash = calculateConfigHash(existingContent);
|
|
51174
51278
|
const newHash = calculateConfigHash(newContent);
|
|
51175
51279
|
if (existingHash !== newHash) {
|
|
51176
51280
|
const backupPath = `${settingsPath}.bak`;
|
|
51177
|
-
(0,
|
|
51281
|
+
(0, import_fs26.writeFileSync)(backupPath, existingContent, "utf-8");
|
|
51178
51282
|
console.log(source_default.yellow("\n Settings changes detected:"));
|
|
51179
51283
|
try {
|
|
51180
51284
|
const existingParsed = JSON.parse(existingContent);
|
|
@@ -51195,115 +51299,123 @@ function writeClaudeConfig(directory, configData, syncedFiles, syncedItems, orgN
|
|
|
51195
51299
|
console.log();
|
|
51196
51300
|
}
|
|
51197
51301
|
}
|
|
51198
|
-
const userSettingsPath = (0,
|
|
51199
|
-
if ((0,
|
|
51200
|
-
const userContent = (0,
|
|
51302
|
+
const userSettingsPath = (0, import_path25.join)((0, import_os19.homedir)(), ".claude", "settings.json");
|
|
51303
|
+
if ((0, import_fs26.existsSync)(userSettingsPath)) {
|
|
51304
|
+
const userContent = (0, import_fs26.readFileSync)(userSettingsPath, "utf-8");
|
|
51201
51305
|
const userHash = calculateConfigHash(userContent);
|
|
51202
51306
|
const orgHash = calculateConfigHash(configData.settings.content);
|
|
51203
51307
|
if (userHash !== orgHash) {
|
|
51204
51308
|
const userBackupPath = `${userSettingsPath}.bak`;
|
|
51205
|
-
(0,
|
|
51309
|
+
(0, import_fs26.writeFileSync)(userBackupPath, userContent, "utf-8");
|
|
51206
51310
|
console.log(source_default.yellow(" User-level settings differ from org baseline."));
|
|
51207
51311
|
console.log(source_default.dim(` Backup: ${userBackupPath}`));
|
|
51208
51312
|
console.log();
|
|
51209
51313
|
}
|
|
51210
51314
|
}
|
|
51211
|
-
|
|
51212
|
-
|
|
51213
|
-
|
|
51214
|
-
|
|
51215
|
-
|
|
51216
|
-
|
|
51217
|
-
|
|
51218
|
-
|
|
51315
|
+
if (isSafeToWrite(settingsPath, ".claude/settings.json")) {
|
|
51316
|
+
(0, import_fs26.writeFileSync)(settingsPath, configData.settings.content, "utf-8");
|
|
51317
|
+
syncedFiles.push(".claude/settings.json");
|
|
51318
|
+
syncedItems.push({
|
|
51319
|
+
path: ".claude/settings.json",
|
|
51320
|
+
type: "settings",
|
|
51321
|
+
name: "settings.json",
|
|
51322
|
+
platform: "claude"
|
|
51323
|
+
});
|
|
51324
|
+
}
|
|
51219
51325
|
}
|
|
51220
51326
|
if (configData.subagents && configData.subagents.length > 0) {
|
|
51221
|
-
const agentsDir = (0,
|
|
51222
|
-
if (!(0,
|
|
51223
|
-
(0,
|
|
51327
|
+
const agentsDir = (0, import_path25.join)(claudeDir, "agents");
|
|
51328
|
+
if (!(0, import_fs26.existsSync)(agentsDir)) {
|
|
51329
|
+
(0, import_fs26.mkdirSync)(agentsDir, { recursive: true });
|
|
51224
51330
|
}
|
|
51225
51331
|
for (const agent of configData.subagents) {
|
|
51226
51332
|
const pathFromName = agent.name.replace(/:/g, "/");
|
|
51227
51333
|
const fileName = pathFromName.endsWith(".md") ? pathFromName : `${pathFromName}.md`;
|
|
51228
|
-
const filePath = (0,
|
|
51229
|
-
const fileDir = (0,
|
|
51230
|
-
if (!(0,
|
|
51231
|
-
(0,
|
|
51334
|
+
const filePath = (0, import_path25.join)(agentsDir, fileName);
|
|
51335
|
+
const fileDir = (0, import_path25.dirname)(filePath);
|
|
51336
|
+
if (!(0, import_fs26.existsSync)(fileDir)) {
|
|
51337
|
+
(0, import_fs26.mkdirSync)(fileDir, { recursive: true });
|
|
51232
51338
|
}
|
|
51233
|
-
(0, import_fs25.writeFileSync)(filePath, agent.content, "utf-8");
|
|
51234
51339
|
const relativePath = `.claude/agents/${fileName}`;
|
|
51235
|
-
|
|
51236
|
-
|
|
51237
|
-
|
|
51238
|
-
|
|
51239
|
-
|
|
51240
|
-
|
|
51241
|
-
|
|
51242
|
-
|
|
51243
|
-
|
|
51340
|
+
if (isSafeToWrite(filePath, relativePath)) {
|
|
51341
|
+
(0, import_fs26.writeFileSync)(filePath, agent.content, "utf-8");
|
|
51342
|
+
syncedFiles.push(relativePath);
|
|
51343
|
+
const { description } = parseCommandFrontmatter(agent.content);
|
|
51344
|
+
syncedItems.push({
|
|
51345
|
+
path: relativePath,
|
|
51346
|
+
type: "agents",
|
|
51347
|
+
name: agent.name.replace(/\.md$/, ""),
|
|
51348
|
+
description,
|
|
51349
|
+
platform: "claude"
|
|
51350
|
+
});
|
|
51351
|
+
}
|
|
51244
51352
|
}
|
|
51245
51353
|
}
|
|
51246
51354
|
if (configData.skills && configData.skills.length > 0) {
|
|
51247
|
-
const skillsDir = (0,
|
|
51248
|
-
if (!(0,
|
|
51249
|
-
(0,
|
|
51355
|
+
const skillsDir = (0, import_path25.join)(claudeDir, "skills");
|
|
51356
|
+
if (!(0, import_fs26.existsSync)(skillsDir)) {
|
|
51357
|
+
(0, import_fs26.mkdirSync)(skillsDir, { recursive: true });
|
|
51250
51358
|
}
|
|
51251
51359
|
for (const skill of configData.skills) {
|
|
51252
|
-
const skillDir = (0,
|
|
51253
|
-
if (!(0,
|
|
51254
|
-
(0,
|
|
51360
|
+
const skillDir = (0, import_path25.join)(skillsDir, skill.name);
|
|
51361
|
+
if (!(0, import_fs26.existsSync)(skillDir)) {
|
|
51362
|
+
(0, import_fs26.mkdirSync)(skillDir, { recursive: true });
|
|
51255
51363
|
}
|
|
51256
|
-
const skillPath = (0,
|
|
51257
|
-
(0, import_fs25.writeFileSync)(skillPath, skill.content, "utf-8");
|
|
51364
|
+
const skillPath = (0, import_path25.join)(skillDir, "SKILL.md");
|
|
51258
51365
|
const relativePath = `.claude/skills/${skill.name}/SKILL.md`;
|
|
51259
|
-
|
|
51260
|
-
|
|
51261
|
-
|
|
51262
|
-
|
|
51263
|
-
|
|
51264
|
-
|
|
51265
|
-
|
|
51266
|
-
|
|
51366
|
+
if (isSafeToWrite(skillPath, relativePath)) {
|
|
51367
|
+
(0, import_fs26.writeFileSync)(skillPath, skill.content, "utf-8");
|
|
51368
|
+
syncedFiles.push(relativePath);
|
|
51369
|
+
syncedItems.push({
|
|
51370
|
+
path: relativePath,
|
|
51371
|
+
type: "skills",
|
|
51372
|
+
name: skill.name,
|
|
51373
|
+
description: skill.description,
|
|
51374
|
+
platform: "claude"
|
|
51375
|
+
});
|
|
51376
|
+
}
|
|
51267
51377
|
}
|
|
51268
51378
|
}
|
|
51269
51379
|
if (configData.rules && configData.rules.length > 0) {
|
|
51270
|
-
const rulesDir = (0,
|
|
51271
|
-
if (!(0,
|
|
51272
|
-
(0,
|
|
51380
|
+
const rulesDir = (0, import_path25.join)(claudeDir, "rules");
|
|
51381
|
+
if (!(0, import_fs26.existsSync)(rulesDir)) {
|
|
51382
|
+
(0, import_fs26.mkdirSync)(rulesDir, { recursive: true });
|
|
51273
51383
|
}
|
|
51274
51384
|
for (const rule of configData.rules) {
|
|
51275
51385
|
const fileName = rule.name.endsWith(".md") ? rule.name : `${rule.name}.md`;
|
|
51276
|
-
const filePath = (0,
|
|
51277
|
-
(0, import_fs25.writeFileSync)(filePath, rule.content, "utf-8");
|
|
51386
|
+
const filePath = (0, import_path25.join)(rulesDir, fileName);
|
|
51278
51387
|
const relativePath = `.claude/rules/${fileName}`;
|
|
51279
|
-
|
|
51280
|
-
|
|
51281
|
-
|
|
51282
|
-
|
|
51283
|
-
|
|
51284
|
-
|
|
51285
|
-
|
|
51388
|
+
if (isSafeToWrite(filePath, relativePath)) {
|
|
51389
|
+
(0, import_fs26.writeFileSync)(filePath, rule.content, "utf-8");
|
|
51390
|
+
syncedFiles.push(relativePath);
|
|
51391
|
+
syncedItems.push({
|
|
51392
|
+
path: relativePath,
|
|
51393
|
+
type: "rules",
|
|
51394
|
+
name: rule.name.replace(/\.md$/, ""),
|
|
51395
|
+
platform: "claude"
|
|
51396
|
+
});
|
|
51397
|
+
}
|
|
51286
51398
|
}
|
|
51287
51399
|
}
|
|
51288
51400
|
}
|
|
51289
51401
|
function writeCodexConfig(directory, configData, syncedFiles, syncedItems) {
|
|
51290
|
-
const codexDir = (0,
|
|
51291
|
-
const codexDirExists = (0,
|
|
51402
|
+
const codexDir = (0, import_path25.join)(directory, ".codex");
|
|
51403
|
+
const codexDirExists = (0, import_fs26.existsSync)(codexDir);
|
|
51292
51404
|
if (!codexDirExists) {
|
|
51293
51405
|
return;
|
|
51294
51406
|
}
|
|
51295
51407
|
if (configData.skills && configData.skills.length > 0) {
|
|
51296
|
-
const skillsDir = (0,
|
|
51297
|
-
if (!(0,
|
|
51298
|
-
(0,
|
|
51408
|
+
const skillsDir = (0, import_path25.join)(codexDir, "skills");
|
|
51409
|
+
if (!(0, import_fs26.existsSync)(skillsDir)) {
|
|
51410
|
+
(0, import_fs26.mkdirSync)(skillsDir, { recursive: true });
|
|
51299
51411
|
}
|
|
51300
51412
|
for (const skill of configData.skills) {
|
|
51301
|
-
const skillDir = (0,
|
|
51302
|
-
if (!(0,
|
|
51303
|
-
(0,
|
|
51413
|
+
const skillDir = (0, import_path25.join)(skillsDir, skill.name);
|
|
51414
|
+
if (!(0, import_fs26.existsSync)(skillDir)) {
|
|
51415
|
+
(0, import_fs26.mkdirSync)(skillDir, { recursive: true });
|
|
51304
51416
|
}
|
|
51305
|
-
const skillPath = (0,
|
|
51306
|
-
(0,
|
|
51417
|
+
const skillPath = (0, import_path25.join)(skillDir, "SKILL.md");
|
|
51418
|
+
(0, import_fs26.writeFileSync)(skillPath, skill.content, "utf-8");
|
|
51307
51419
|
const relativePath = `.codex/skills/${skill.name}/SKILL.md`;
|
|
51308
51420
|
syncedFiles.push(relativePath);
|
|
51309
51421
|
syncedItems.push({
|
|
@@ -51315,8 +51427,8 @@ function writeCodexConfig(directory, configData, syncedFiles, syncedItems) {
|
|
|
51315
51427
|
}
|
|
51316
51428
|
}
|
|
51317
51429
|
if (configData.settings?.content) {
|
|
51318
|
-
const settingsPath = (0,
|
|
51319
|
-
(0,
|
|
51430
|
+
const settingsPath = (0, import_path25.join)(codexDir, "settings.json");
|
|
51431
|
+
(0, import_fs26.writeFileSync)(settingsPath, configData.settings.content, "utf-8");
|
|
51320
51432
|
syncedFiles.push(".codex/settings.json");
|
|
51321
51433
|
syncedItems.push({
|
|
51322
51434
|
path: ".codex/settings.json",
|
|
@@ -51332,15 +51444,15 @@ function codexPromptFileNameFromCommand(commandName) {
|
|
|
51332
51444
|
}
|
|
51333
51445
|
function writeCodexPrompts(commands) {
|
|
51334
51446
|
if (!commands || commands.length === 0) return 0;
|
|
51335
|
-
const promptsDir = (0,
|
|
51336
|
-
if (!(0,
|
|
51337
|
-
(0,
|
|
51447
|
+
const promptsDir = (0, import_path25.join)((0, import_os19.homedir)(), ".codex", "prompts");
|
|
51448
|
+
if (!(0, import_fs26.existsSync)(promptsDir)) {
|
|
51449
|
+
(0, import_fs26.mkdirSync)(promptsDir, { recursive: true });
|
|
51338
51450
|
}
|
|
51339
51451
|
let written = 0;
|
|
51340
51452
|
for (const command of commands) {
|
|
51341
51453
|
const fileName = codexPromptFileNameFromCommand(command.name);
|
|
51342
|
-
const filePath = (0,
|
|
51343
|
-
(0,
|
|
51454
|
+
const filePath = (0, import_path25.join)(promptsDir, fileName);
|
|
51455
|
+
(0, import_fs26.writeFileSync)(filePath, command.content, "utf-8");
|
|
51344
51456
|
written += 1;
|
|
51345
51457
|
}
|
|
51346
51458
|
return written;
|
|
@@ -51372,119 +51484,119 @@ function writeGeminiCommandsAndSkills(directory, configData) {
|
|
|
51372
51484
|
let commandsWritten = 0;
|
|
51373
51485
|
let skillsWritten = 0;
|
|
51374
51486
|
if (configData.commands && configData.commands.length > 0) {
|
|
51375
|
-
const commandsDir = (0,
|
|
51376
|
-
if (!(0,
|
|
51377
|
-
(0,
|
|
51487
|
+
const commandsDir = (0, import_path25.join)(directory, GEMINI_COMMANDS_DIR);
|
|
51488
|
+
if (!(0, import_fs26.existsSync)(commandsDir)) {
|
|
51489
|
+
(0, import_fs26.mkdirSync)(commandsDir, { recursive: true });
|
|
51378
51490
|
}
|
|
51379
51491
|
for (const cmd of configData.commands) {
|
|
51380
51492
|
const pathFromName = cmd.name.replace(/:/g, "/");
|
|
51381
|
-
const filePath = (0,
|
|
51382
|
-
const fileDir = (0,
|
|
51383
|
-
if (!(0,
|
|
51384
|
-
(0,
|
|
51493
|
+
const filePath = (0, import_path25.join)(commandsDir, `${pathFromName}.toml`);
|
|
51494
|
+
const fileDir = (0, import_path25.dirname)(filePath);
|
|
51495
|
+
if (!(0, import_fs26.existsSync)(fileDir)) {
|
|
51496
|
+
(0, import_fs26.mkdirSync)(fileDir, { recursive: true });
|
|
51385
51497
|
}
|
|
51386
51498
|
const description = extractDescription2(cmd.content);
|
|
51387
51499
|
const toml = buildGeminiCommandToml(cmd.name, description, cmd.content);
|
|
51388
|
-
(0,
|
|
51500
|
+
(0, import_fs26.writeFileSync)(filePath, toml, "utf-8");
|
|
51389
51501
|
commandsWritten += 1;
|
|
51390
51502
|
}
|
|
51391
51503
|
}
|
|
51392
51504
|
if (configData.skills && configData.skills.length > 0) {
|
|
51393
|
-
const skillsDir = (0,
|
|
51394
|
-
if (!(0,
|
|
51395
|
-
(0,
|
|
51505
|
+
const skillsDir = (0, import_path25.join)(directory, GEMINI_SKILLS_DIR);
|
|
51506
|
+
if (!(0, import_fs26.existsSync)(skillsDir)) {
|
|
51507
|
+
(0, import_fs26.mkdirSync)(skillsDir, { recursive: true });
|
|
51396
51508
|
}
|
|
51397
51509
|
for (const skill of configData.skills) {
|
|
51398
|
-
const skillDir = (0,
|
|
51399
|
-
if (!(0,
|
|
51400
|
-
(0,
|
|
51510
|
+
const skillDir = (0, import_path25.join)(skillsDir, skill.name);
|
|
51511
|
+
if (!(0, import_fs26.existsSync)(skillDir)) {
|
|
51512
|
+
(0, import_fs26.mkdirSync)(skillDir, { recursive: true });
|
|
51401
51513
|
}
|
|
51402
|
-
const skillPath = (0,
|
|
51403
|
-
(0,
|
|
51514
|
+
const skillPath = (0, import_path25.join)(skillDir, "SKILL.md");
|
|
51515
|
+
(0, import_fs26.writeFileSync)(skillPath, skill.content, "utf-8");
|
|
51404
51516
|
skillsWritten += 1;
|
|
51405
51517
|
}
|
|
51406
51518
|
}
|
|
51407
51519
|
return { commandsWritten, skillsWritten };
|
|
51408
51520
|
}
|
|
51409
51521
|
function writeApprovedClaudeConfig(directory, configData) {
|
|
51410
|
-
const approvedRoot = (0,
|
|
51411
|
-
const approvedClaudeDir = (0,
|
|
51412
|
-
if (!(0,
|
|
51413
|
-
(0,
|
|
51522
|
+
const approvedRoot = (0, import_path25.join)(directory, ".gal", "approved", "claude");
|
|
51523
|
+
const approvedClaudeDir = (0, import_path25.join)(approvedRoot, ".claude");
|
|
51524
|
+
if (!(0, import_fs26.existsSync)(approvedClaudeDir)) {
|
|
51525
|
+
(0, import_fs26.mkdirSync)(approvedClaudeDir, { recursive: true });
|
|
51414
51526
|
}
|
|
51415
51527
|
if (configData.instructions?.content) {
|
|
51416
|
-
const claudeMdPath = (0,
|
|
51417
|
-
(0,
|
|
51528
|
+
const claudeMdPath = (0, import_path25.join)(approvedRoot, "CLAUDE.md");
|
|
51529
|
+
(0, import_fs26.writeFileSync)(claudeMdPath, configData.instructions.content, "utf-8");
|
|
51418
51530
|
}
|
|
51419
51531
|
if (configData.commands && configData.commands.length > 0) {
|
|
51420
|
-
const commandsDir = (0,
|
|
51421
|
-
if (!(0,
|
|
51422
|
-
(0,
|
|
51532
|
+
const commandsDir = (0, import_path25.join)(approvedClaudeDir, "commands");
|
|
51533
|
+
if (!(0, import_fs26.existsSync)(commandsDir)) {
|
|
51534
|
+
(0, import_fs26.mkdirSync)(commandsDir, { recursive: true });
|
|
51423
51535
|
}
|
|
51424
51536
|
for (const cmd of configData.commands) {
|
|
51425
51537
|
const pathFromName = cmd.name.replace(/:/g, "/");
|
|
51426
51538
|
const fileName = pathFromName.endsWith(".md") ? pathFromName : `${pathFromName}.md`;
|
|
51427
|
-
const filePath = (0,
|
|
51428
|
-
const fileDir = (0,
|
|
51429
|
-
if (!(0,
|
|
51430
|
-
(0,
|
|
51539
|
+
const filePath = (0, import_path25.join)(commandsDir, fileName);
|
|
51540
|
+
const fileDir = (0, import_path25.dirname)(filePath);
|
|
51541
|
+
if (!(0, import_fs26.existsSync)(fileDir)) {
|
|
51542
|
+
(0, import_fs26.mkdirSync)(fileDir, { recursive: true });
|
|
51431
51543
|
}
|
|
51432
|
-
(0,
|
|
51544
|
+
(0, import_fs26.writeFileSync)(filePath, cmd.content, "utf-8");
|
|
51433
51545
|
}
|
|
51434
51546
|
}
|
|
51435
51547
|
if (configData.hooks && configData.hooks.length > 0) {
|
|
51436
|
-
const hooksDir = (0,
|
|
51437
|
-
if (!(0,
|
|
51438
|
-
(0,
|
|
51548
|
+
const hooksDir = (0, import_path25.join)(approvedClaudeDir, "hooks");
|
|
51549
|
+
if (!(0, import_fs26.existsSync)(hooksDir)) {
|
|
51550
|
+
(0, import_fs26.mkdirSync)(hooksDir, { recursive: true });
|
|
51439
51551
|
}
|
|
51440
51552
|
for (const hook of configData.hooks) {
|
|
51441
|
-
const filePath = (0,
|
|
51442
|
-
(0,
|
|
51553
|
+
const filePath = (0, import_path25.join)(hooksDir, hook.name);
|
|
51554
|
+
(0, import_fs26.writeFileSync)(filePath, hook.content, "utf-8");
|
|
51443
51555
|
}
|
|
51444
51556
|
}
|
|
51445
51557
|
if (configData.settings?.content) {
|
|
51446
|
-
const settingsPath = (0,
|
|
51447
|
-
(0,
|
|
51558
|
+
const settingsPath = (0, import_path25.join)(approvedClaudeDir, "settings.json");
|
|
51559
|
+
(0, import_fs26.writeFileSync)(settingsPath, configData.settings.content, "utf-8");
|
|
51448
51560
|
}
|
|
51449
51561
|
if (configData.subagents && configData.subagents.length > 0) {
|
|
51450
|
-
const agentsDir = (0,
|
|
51451
|
-
if (!(0,
|
|
51452
|
-
(0,
|
|
51562
|
+
const agentsDir = (0, import_path25.join)(approvedClaudeDir, "agents");
|
|
51563
|
+
if (!(0, import_fs26.existsSync)(agentsDir)) {
|
|
51564
|
+
(0, import_fs26.mkdirSync)(agentsDir, { recursive: true });
|
|
51453
51565
|
}
|
|
51454
51566
|
for (const agent of configData.subagents) {
|
|
51455
51567
|
const pathFromName = agent.name.replace(/:/g, "/");
|
|
51456
51568
|
const fileName = pathFromName.endsWith(".md") ? pathFromName : `${pathFromName}.md`;
|
|
51457
|
-
const filePath = (0,
|
|
51458
|
-
const fileDir = (0,
|
|
51459
|
-
if (!(0,
|
|
51460
|
-
(0,
|
|
51569
|
+
const filePath = (0, import_path25.join)(agentsDir, fileName);
|
|
51570
|
+
const fileDir = (0, import_path25.dirname)(filePath);
|
|
51571
|
+
if (!(0, import_fs26.existsSync)(fileDir)) {
|
|
51572
|
+
(0, import_fs26.mkdirSync)(fileDir, { recursive: true });
|
|
51461
51573
|
}
|
|
51462
|
-
(0,
|
|
51574
|
+
(0, import_fs26.writeFileSync)(filePath, agent.content, "utf-8");
|
|
51463
51575
|
}
|
|
51464
51576
|
}
|
|
51465
51577
|
if (configData.skills && configData.skills.length > 0) {
|
|
51466
|
-
const skillsDir = (0,
|
|
51467
|
-
if (!(0,
|
|
51468
|
-
(0,
|
|
51578
|
+
const skillsDir = (0, import_path25.join)(approvedClaudeDir, "skills");
|
|
51579
|
+
if (!(0, import_fs26.existsSync)(skillsDir)) {
|
|
51580
|
+
(0, import_fs26.mkdirSync)(skillsDir, { recursive: true });
|
|
51469
51581
|
}
|
|
51470
51582
|
for (const skill of configData.skills) {
|
|
51471
|
-
const skillDir = (0,
|
|
51472
|
-
if (!(0,
|
|
51473
|
-
(0,
|
|
51583
|
+
const skillDir = (0, import_path25.join)(skillsDir, skill.name);
|
|
51584
|
+
if (!(0, import_fs26.existsSync)(skillDir)) {
|
|
51585
|
+
(0, import_fs26.mkdirSync)(skillDir, { recursive: true });
|
|
51474
51586
|
}
|
|
51475
|
-
const skillPath = (0,
|
|
51476
|
-
(0,
|
|
51587
|
+
const skillPath = (0, import_path25.join)(skillDir, "SKILL.md");
|
|
51588
|
+
(0, import_fs26.writeFileSync)(skillPath, skill.content, "utf-8");
|
|
51477
51589
|
}
|
|
51478
51590
|
}
|
|
51479
51591
|
if (configData.rules && configData.rules.length > 0) {
|
|
51480
|
-
const rulesDir = (0,
|
|
51481
|
-
if (!(0,
|
|
51482
|
-
(0,
|
|
51592
|
+
const rulesDir = (0, import_path25.join)(approvedClaudeDir, "rules");
|
|
51593
|
+
if (!(0, import_fs26.existsSync)(rulesDir)) {
|
|
51594
|
+
(0, import_fs26.mkdirSync)(rulesDir, { recursive: true });
|
|
51483
51595
|
}
|
|
51484
51596
|
for (const rule of configData.rules) {
|
|
51485
51597
|
const fileName = rule.name.endsWith(".md") ? rule.name : `${rule.name}.md`;
|
|
51486
|
-
const filePath = (0,
|
|
51487
|
-
(0,
|
|
51598
|
+
const filePath = (0, import_path25.join)(rulesDir, fileName);
|
|
51599
|
+
(0, import_fs26.writeFileSync)(filePath, rule.content, "utf-8");
|
|
51488
51600
|
}
|
|
51489
51601
|
}
|
|
51490
51602
|
}
|
|
@@ -51626,6 +51738,9 @@ async function pullApprovedConfig(configRepo, authRepo, orgName, directory, plat
|
|
|
51626
51738
|
message: platformFilter ? `No approved config found for platform '${platformFilter}'.` : `No approved configs found for organization '${orgName}'.`
|
|
51627
51739
|
};
|
|
51628
51740
|
}
|
|
51741
|
+
const gitRepoRoot = findGitRepoRoot(directory);
|
|
51742
|
+
const isForce = options?.force ?? false;
|
|
51743
|
+
const allConflictFiles = [];
|
|
51629
51744
|
const platformStates = /* @__PURE__ */ new Map();
|
|
51630
51745
|
const allSyncedFiles = [];
|
|
51631
51746
|
const allSyncedItems = [];
|
|
@@ -51681,7 +51796,16 @@ async function pullApprovedConfig(configRepo, authRepo, orgName, directory, plat
|
|
|
51681
51796
|
if (platform5 === "cursor") {
|
|
51682
51797
|
writeCursorConfig(directory, configData, platformFiles, platformItems);
|
|
51683
51798
|
} else if (platform5 === "claude") {
|
|
51684
|
-
writeClaudeConfig(
|
|
51799
|
+
writeClaudeConfig(
|
|
51800
|
+
directory,
|
|
51801
|
+
configData,
|
|
51802
|
+
platformFiles,
|
|
51803
|
+
platformItems,
|
|
51804
|
+
orgName,
|
|
51805
|
+
gitRepoRoot,
|
|
51806
|
+
isForce,
|
|
51807
|
+
allConflictFiles
|
|
51808
|
+
);
|
|
51685
51809
|
writeApprovedClaudeConfig(directory, configData);
|
|
51686
51810
|
} else if (platform5 === "codex") {
|
|
51687
51811
|
writeCodexConfig(directory, configData, platformFiles, platformItems);
|
|
@@ -51761,20 +51885,20 @@ async function pullApprovedConfig(configRepo, authRepo, orgName, directory, plat
|
|
|
51761
51885
|
} else {
|
|
51762
51886
|
if (configData.configContent) {
|
|
51763
51887
|
const platformDir = getPlatformDirectory(platform5);
|
|
51764
|
-
const configPath = (0,
|
|
51765
|
-
if (!(0,
|
|
51766
|
-
(0,
|
|
51888
|
+
const configPath = (0, import_path25.join)(directory, platformDir);
|
|
51889
|
+
if (!(0, import_fs26.existsSync)(configPath)) {
|
|
51890
|
+
(0, import_fs26.mkdirSync)(configPath, { recursive: true });
|
|
51767
51891
|
}
|
|
51768
51892
|
try {
|
|
51769
51893
|
const parsedContent = JSON.parse(configData.configContent);
|
|
51770
51894
|
for (const [filePath, content] of Object.entries(parsedContent)) {
|
|
51771
|
-
const fullPath = (0,
|
|
51772
|
-
const dir = (0,
|
|
51773
|
-
if (!(0,
|
|
51774
|
-
(0,
|
|
51895
|
+
const fullPath = (0, import_path25.join)(configPath, filePath);
|
|
51896
|
+
const dir = (0, import_path25.dirname)(fullPath);
|
|
51897
|
+
if (!(0, import_fs26.existsSync)(dir)) {
|
|
51898
|
+
(0, import_fs26.mkdirSync)(dir, { recursive: true });
|
|
51775
51899
|
}
|
|
51776
|
-
(0,
|
|
51777
|
-
platformFiles.push((0,
|
|
51900
|
+
(0, import_fs26.writeFileSync)(fullPath, content);
|
|
51901
|
+
platformFiles.push((0, import_path25.join)(platformDir, filePath));
|
|
51778
51902
|
platformItems.push({
|
|
51779
51903
|
path: filePath,
|
|
51780
51904
|
type: getItemType(filePath),
|
|
@@ -51783,9 +51907,9 @@ async function pullApprovedConfig(configRepo, authRepo, orgName, directory, plat
|
|
|
51783
51907
|
});
|
|
51784
51908
|
}
|
|
51785
51909
|
} catch {
|
|
51786
|
-
const singlePath = (0,
|
|
51787
|
-
(0,
|
|
51788
|
-
platformFiles.push((0,
|
|
51910
|
+
const singlePath = (0, import_path25.join)(configPath, "approved-config.json");
|
|
51911
|
+
(0, import_fs26.writeFileSync)(singlePath, configData.configContent);
|
|
51912
|
+
platformFiles.push((0, import_path25.join)(platformDir, "approved-config.json"));
|
|
51789
51913
|
}
|
|
51790
51914
|
}
|
|
51791
51915
|
}
|
|
@@ -51942,16 +52066,16 @@ async function pullApprovedConfig(configRepo, authRepo, orgName, directory, plat
|
|
|
51942
52066
|
}
|
|
51943
52067
|
} catch {
|
|
51944
52068
|
}
|
|
51945
|
-
const existingAgentsMdPath = (0,
|
|
52069
|
+
const existingAgentsMdPath = (0, import_path25.join)(directory, "AGENTS.md");
|
|
51946
52070
|
let existingDocsIndex;
|
|
51947
|
-
if ((0,
|
|
51948
|
-
const existingContent = (0,
|
|
52071
|
+
if ((0, import_fs26.existsSync)(existingAgentsMdPath)) {
|
|
52072
|
+
const existingContent = (0, import_fs26.readFileSync)(existingAgentsMdPath, "utf-8");
|
|
51949
52073
|
const dispatchMarker = "|@section:background-dispatch";
|
|
51950
52074
|
const markerIndex = existingContent.indexOf(dispatchMarker);
|
|
51951
52075
|
existingDocsIndex = markerIndex >= 0 ? existingContent.substring(0, markerIndex).trim() : existingContent.trim();
|
|
51952
52076
|
}
|
|
51953
52077
|
const agentsMdContent = generateAgentsMd(existingDocsIndex, dispatchRules);
|
|
51954
|
-
(0,
|
|
52078
|
+
(0, import_fs26.writeFileSync)(existingAgentsMdPath, agentsMdContent, "utf-8");
|
|
51955
52079
|
allSyncedFiles.push("AGENTS.md");
|
|
51956
52080
|
allSyncedItems.push({
|
|
51957
52081
|
path: "AGENTS.md",
|
|
@@ -51965,11 +52089,11 @@ async function pullApprovedConfig(configRepo, authRepo, orgName, directory, plat
|
|
|
51965
52089
|
console.log(source_default.dim(` Written: AGENTS.md (universal cross-platform)`));
|
|
51966
52090
|
}
|
|
51967
52091
|
if (dispatchRules) {
|
|
51968
|
-
const galDir = (0,
|
|
51969
|
-
if (!(0,
|
|
51970
|
-
(0,
|
|
52092
|
+
const galDir = (0, import_path25.join)(directory, ".gal");
|
|
52093
|
+
if (!(0, import_fs26.existsSync)(galDir)) {
|
|
52094
|
+
(0, import_fs26.mkdirSync)(galDir, { recursive: true });
|
|
51971
52095
|
}
|
|
51972
|
-
(0,
|
|
52096
|
+
(0, import_fs26.writeFileSync)((0, import_path25.join)(galDir, "dispatch-rules.json"), JSON.stringify(dispatchRules), "utf-8");
|
|
51973
52097
|
if (isFullOutput) {
|
|
51974
52098
|
console.log(source_default.dim(` Written: .gal/dispatch-rules.json (hook cache)`));
|
|
51975
52099
|
}
|
|
@@ -52084,6 +52208,14 @@ async function pullApprovedConfig(configRepo, authRepo, orgName, directory, plat
|
|
|
52084
52208
|
});
|
|
52085
52209
|
} catch {
|
|
52086
52210
|
}
|
|
52211
|
+
if (isFullOutput && allConflictFiles.length > 0) {
|
|
52212
|
+
console.log(source_default.yellow(`
|
|
52213
|
+
\u26A0 ${allConflictFiles.length} file(s) skipped \u2014 git-tracked with local changes:`));
|
|
52214
|
+
for (const f of allConflictFiles) {
|
|
52215
|
+
console.log(source_default.dim(` \u2022 ${f}`));
|
|
52216
|
+
}
|
|
52217
|
+
console.log(source_default.dim(` To overwrite these files, rerun with: gal sync --pull --force`));
|
|
52218
|
+
}
|
|
52087
52219
|
if (isFullOutput) {
|
|
52088
52220
|
console.log(source_default.green("\n\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550"));
|
|
52089
52221
|
console.log(source_default.green(" \u2713 Sync complete! Your configs match org standard."));
|
|
@@ -52172,12 +52304,12 @@ async function pullPersonalRepoConfig(authRepo, repoName, directory) {
|
|
|
52172
52304
|
const syncedItems = [];
|
|
52173
52305
|
for (const config2 of configs) {
|
|
52174
52306
|
const relativePath = config2.path.replace(/^\/+/, "");
|
|
52175
|
-
const fullPath = (0,
|
|
52176
|
-
const dir = (0,
|
|
52177
|
-
if (!(0,
|
|
52178
|
-
(0,
|
|
52307
|
+
const fullPath = (0, import_path25.join)(directory, relativePath);
|
|
52308
|
+
const dir = (0, import_path25.dirname)(fullPath);
|
|
52309
|
+
if (!(0, import_fs26.existsSync)(dir)) {
|
|
52310
|
+
(0, import_fs26.mkdirSync)(dir, { recursive: true });
|
|
52179
52311
|
}
|
|
52180
|
-
(0,
|
|
52312
|
+
(0, import_fs26.writeFileSync)(fullPath, config2.content);
|
|
52181
52313
|
syncedFiles.push(relativePath);
|
|
52182
52314
|
const itemType = getItemType(relativePath);
|
|
52183
52315
|
const itemName = getItemName(relativePath);
|
|
@@ -52227,20 +52359,20 @@ async function pullPersonalApprovedConfig(authRepo, approvedConfig, directory) {
|
|
|
52227
52359
|
}
|
|
52228
52360
|
const configData = JSON.parse(approvedConfig.configContent);
|
|
52229
52361
|
const platformDir = ".claude";
|
|
52230
|
-
const configPath = (0,
|
|
52231
|
-
if (!(0,
|
|
52232
|
-
(0,
|
|
52362
|
+
const configPath = (0, import_path25.join)(directory, platformDir);
|
|
52363
|
+
if (!(0, import_fs26.existsSync)(configPath)) {
|
|
52364
|
+
(0, import_fs26.mkdirSync)(configPath, { recursive: true });
|
|
52233
52365
|
}
|
|
52234
52366
|
const syncedFiles = [];
|
|
52235
52367
|
const syncedItems = [];
|
|
52236
52368
|
for (const [filePath, content] of Object.entries(configData)) {
|
|
52237
|
-
const fullPath = (0,
|
|
52238
|
-
const dir = (0,
|
|
52239
|
-
if (!(0,
|
|
52240
|
-
(0,
|
|
52369
|
+
const fullPath = (0, import_path25.join)(configPath, filePath);
|
|
52370
|
+
const dir = (0, import_path25.dirname)(fullPath);
|
|
52371
|
+
if (!(0, import_fs26.existsSync)(dir)) {
|
|
52372
|
+
(0, import_fs26.mkdirSync)(dir, { recursive: true });
|
|
52241
52373
|
}
|
|
52242
|
-
(0,
|
|
52243
|
-
const relativePath = (0,
|
|
52374
|
+
(0, import_fs26.writeFileSync)(fullPath, content);
|
|
52375
|
+
const relativePath = (0, import_path25.join)(platformDir, filePath);
|
|
52244
52376
|
syncedFiles.push(relativePath);
|
|
52245
52377
|
const itemType = getItemType(filePath);
|
|
52246
52378
|
const itemName = getItemName(filePath);
|
|
@@ -52300,18 +52432,18 @@ async function checkApprovedConfig(configRepo, orgName, directory, platformFilte
|
|
|
52300
52432
|
const platformDir = getPlatformDirectory(platform5);
|
|
52301
52433
|
if (approvedConfig.instructions?.content) {
|
|
52302
52434
|
const relativePath = "CLAUDE.md";
|
|
52303
|
-
const fullPath = (0,
|
|
52435
|
+
const fullPath = (0, import_path25.join)(directory, relativePath);
|
|
52304
52436
|
result.expectedFiles.push(relativePath);
|
|
52305
|
-
if (!(0,
|
|
52437
|
+
if (!(0, import_fs26.existsSync)(fullPath)) {
|
|
52306
52438
|
result.missingFiles.push(relativePath);
|
|
52307
52439
|
result.inSync = false;
|
|
52308
52440
|
}
|
|
52309
52441
|
}
|
|
52310
52442
|
if (approvedConfig.settings?.content) {
|
|
52311
|
-
const relativePath = (0,
|
|
52312
|
-
const fullPath = (0,
|
|
52443
|
+
const relativePath = (0, import_path25.join)(platformDir, "settings.json");
|
|
52444
|
+
const fullPath = (0, import_path25.join)(directory, relativePath);
|
|
52313
52445
|
result.expectedFiles.push(relativePath);
|
|
52314
|
-
if (!(0,
|
|
52446
|
+
if (!(0, import_fs26.existsSync)(fullPath)) {
|
|
52315
52447
|
result.missingFiles.push(relativePath);
|
|
52316
52448
|
result.inSync = false;
|
|
52317
52449
|
}
|
|
@@ -52320,10 +52452,10 @@ async function checkApprovedConfig(configRepo, orgName, directory, platformFilte
|
|
|
52320
52452
|
for (const cmd of approvedConfig.commands) {
|
|
52321
52453
|
const pathFromName = cmd.name.replace(/:/g, "/");
|
|
52322
52454
|
const fileName = pathFromName.endsWith(".md") ? pathFromName : `${pathFromName}.md`;
|
|
52323
|
-
const relativePath = (0,
|
|
52324
|
-
const fullPath = (0,
|
|
52455
|
+
const relativePath = (0, import_path25.join)(platformDir, "commands", fileName);
|
|
52456
|
+
const fullPath = (0, import_path25.join)(directory, relativePath);
|
|
52325
52457
|
result.expectedFiles.push(relativePath);
|
|
52326
|
-
if (!(0,
|
|
52458
|
+
if (!(0, import_fs26.existsSync)(fullPath)) {
|
|
52327
52459
|
result.missingFiles.push(relativePath);
|
|
52328
52460
|
result.inSync = false;
|
|
52329
52461
|
}
|
|
@@ -52332,10 +52464,10 @@ async function checkApprovedConfig(configRepo, orgName, directory, platformFilte
|
|
|
52332
52464
|
if (approvedConfig.rules && approvedConfig.rules.length > 0) {
|
|
52333
52465
|
for (const rule of approvedConfig.rules) {
|
|
52334
52466
|
const fileName = rule.name.endsWith(".md") ? rule.name : `${rule.name}.md`;
|
|
52335
|
-
const relativePath = (0,
|
|
52336
|
-
const fullPath = (0,
|
|
52467
|
+
const relativePath = (0, import_path25.join)(platformDir, "rules", fileName);
|
|
52468
|
+
const fullPath = (0, import_path25.join)(directory, relativePath);
|
|
52337
52469
|
result.expectedFiles.push(relativePath);
|
|
52338
|
-
if (!(0,
|
|
52470
|
+
if (!(0, import_fs26.existsSync)(fullPath)) {
|
|
52339
52471
|
result.missingFiles.push(relativePath);
|
|
52340
52472
|
result.inSync = false;
|
|
52341
52473
|
}
|
|
@@ -52346,7 +52478,7 @@ async function checkApprovedConfig(configRepo, orgName, directory, platformFilte
|
|
|
52346
52478
|
}
|
|
52347
52479
|
console.log(JSON.stringify(result));
|
|
52348
52480
|
}
|
|
52349
|
-
var
|
|
52481
|
+
var import_fs26, import_path25, import_os19, import_crypto6, cliVersion4, defaultApiUrl4, GAL_CLI_CURSOR_RULES_VERSION, GAL_CLI_CURSOR_RULES, CODEX_PROMPT_PREFIX, GEMINI_COMMANDS_DIR, GEMINI_SKILLS_DIR;
|
|
52350
52482
|
var init_sync = __esm({
|
|
52351
52483
|
"src/commands/sync.ts"() {
|
|
52352
52484
|
"use strict";
|
|
@@ -52356,8 +52488,8 @@ var init_sync = __esm({
|
|
|
52356
52488
|
init_constants();
|
|
52357
52489
|
init_config_manager();
|
|
52358
52490
|
init_telemetry();
|
|
52359
|
-
|
|
52360
|
-
|
|
52491
|
+
import_fs26 = require("fs");
|
|
52492
|
+
import_path25 = require("path");
|
|
52361
52493
|
import_os19 = require("os");
|
|
52362
52494
|
init_project_detection();
|
|
52363
52495
|
import_crypto6 = require("crypto");
|
|
@@ -52371,6 +52503,7 @@ var init_sync = __esm({
|
|
|
52371
52503
|
init_mcp_config_writer();
|
|
52372
52504
|
init_browser_profile_sync();
|
|
52373
52505
|
init_sync_initialization();
|
|
52506
|
+
init_git_utils();
|
|
52374
52507
|
cliVersion4 = constants_default[0];
|
|
52375
52508
|
defaultApiUrl4 = constants_default[1];
|
|
52376
52509
|
GAL_CLI_CURSOR_RULES_VERSION = "1.0.0";
|
|
@@ -52427,11 +52560,11 @@ function openBrowser(url) {
|
|
|
52427
52560
|
const platform5 = process.platform;
|
|
52428
52561
|
try {
|
|
52429
52562
|
if (platform5 === "darwin") {
|
|
52430
|
-
(0,
|
|
52563
|
+
(0, import_child_process9.execSync)(`open "${url}"`);
|
|
52431
52564
|
} else if (platform5 === "win32") {
|
|
52432
|
-
(0,
|
|
52565
|
+
(0, import_child_process9.execSync)(`start "" "${url}"`);
|
|
52433
52566
|
} else {
|
|
52434
|
-
(0,
|
|
52567
|
+
(0, import_child_process9.execSync)(`xdg-open "${url}"`);
|
|
52435
52568
|
}
|
|
52436
52569
|
} catch {
|
|
52437
52570
|
console.log(source_default.yellow(`
|
|
@@ -52935,7 +53068,7 @@ Review status: ${source_default.cyan("gal auth status")}
|
|
|
52935
53068
|
let accessToken;
|
|
52936
53069
|
let refreshToken;
|
|
52937
53070
|
let expiresAt;
|
|
52938
|
-
const claudeDir = (0,
|
|
53071
|
+
const claudeDir = (0, import_path26.join)((0, import_os20.homedir)(), ".claude");
|
|
52939
53072
|
let credentialSource2 = "";
|
|
52940
53073
|
const isSetupTokenMode2 = !!options.setupToken;
|
|
52941
53074
|
if (options.setupToken) {
|
|
@@ -52951,7 +53084,7 @@ Review status: ${source_default.cyan("gal auth status")}
|
|
|
52951
53084
|
if (verbose) {
|
|
52952
53085
|
spinner.info(source_default.dim(' Trying macOS Keychain (service: "Claude Code-credentials")...'));
|
|
52953
53086
|
}
|
|
52954
|
-
const keychainResult = (0,
|
|
53087
|
+
const keychainResult = (0, import_child_process9.execSync)(
|
|
52955
53088
|
'security find-generic-password -s "Claude Code-credentials" -w',
|
|
52956
53089
|
{ encoding: "utf-8", timeout: 1e4, stdio: ["pipe", "pipe", "pipe"] }
|
|
52957
53090
|
).trim();
|
|
@@ -53016,13 +53149,13 @@ Review status: ${source_default.cyan("gal auth status")}
|
|
|
53016
53149
|
}
|
|
53017
53150
|
}
|
|
53018
53151
|
if (!isSetupTokenMode2 && (!accessToken || !refreshToken)) {
|
|
53019
|
-
const legacyCredentialsPath = (0,
|
|
53152
|
+
const legacyCredentialsPath = (0, import_path26.join)(claudeDir, ".credentials.json");
|
|
53020
53153
|
if (verbose) {
|
|
53021
53154
|
spinner.info(source_default.dim(` Trying ${legacyCredentialsPath}...`));
|
|
53022
53155
|
}
|
|
53023
|
-
if ((0,
|
|
53156
|
+
if ((0, import_fs27.existsSync)(legacyCredentialsPath)) {
|
|
53024
53157
|
try {
|
|
53025
|
-
const content = (0,
|
|
53158
|
+
const content = (0, import_fs27.readFileSync)(legacyCredentialsPath, "utf-8");
|
|
53026
53159
|
const credentials = JSON.parse(content);
|
|
53027
53160
|
accessToken = credentials.claudeAiOauth?.accessToken;
|
|
53028
53161
|
refreshToken = credentials.claudeAiOauth?.refreshToken;
|
|
@@ -53046,13 +53179,13 @@ Review status: ${source_default.cyan("gal auth status")}
|
|
|
53046
53179
|
}
|
|
53047
53180
|
}
|
|
53048
53181
|
if (!isSetupTokenMode2 && (!accessToken || !refreshToken)) {
|
|
53049
|
-
const configPath = (0,
|
|
53182
|
+
const configPath = (0, import_path26.join)(claudeDir, ".claude.json");
|
|
53050
53183
|
if (verbose) {
|
|
53051
53184
|
spinner.info(source_default.dim(` Trying ${configPath} (oauthCredentials field)...`));
|
|
53052
53185
|
}
|
|
53053
|
-
if ((0,
|
|
53186
|
+
if ((0, import_fs27.existsSync)(configPath)) {
|
|
53054
53187
|
try {
|
|
53055
|
-
const content = (0,
|
|
53188
|
+
const content = (0, import_fs27.readFileSync)(configPath, "utf-8");
|
|
53056
53189
|
const claudeConfig = JSON.parse(content);
|
|
53057
53190
|
accessToken = claudeConfig.oauthCredentials?.claudeAiOauth?.accessToken;
|
|
53058
53191
|
refreshToken = claudeConfig.oauthCredentials?.claudeAiOauth?.refreshToken;
|
|
@@ -53182,13 +53315,13 @@ Review status: ${source_default.cyan("gal auth status")}
|
|
|
53182
53315
|
spinner.info(source_default.dim(" Using API key from command line"));
|
|
53183
53316
|
}
|
|
53184
53317
|
} else {
|
|
53185
|
-
const codexAuthPath = (0,
|
|
53318
|
+
const codexAuthPath = (0, import_path26.join)((0, import_os20.homedir)(), ".codex", "auth.json");
|
|
53186
53319
|
if (verbose) {
|
|
53187
53320
|
spinner.info(source_default.dim(` Trying ${codexAuthPath}...`));
|
|
53188
53321
|
}
|
|
53189
|
-
if ((0,
|
|
53322
|
+
if ((0, import_fs27.existsSync)(codexAuthPath)) {
|
|
53190
53323
|
try {
|
|
53191
|
-
const content = (0,
|
|
53324
|
+
const content = (0, import_fs27.readFileSync)(codexAuthPath, "utf-8");
|
|
53192
53325
|
const authData = JSON.parse(content);
|
|
53193
53326
|
if (verbose) {
|
|
53194
53327
|
spinner.info(source_default.dim(` Found auth.json, checking tokens...`));
|
|
@@ -53300,13 +53433,13 @@ Source: ${credentialSource2}`));
|
|
|
53300
53433
|
spinner.info(source_default.dim(" Using API key from command line"));
|
|
53301
53434
|
}
|
|
53302
53435
|
} else {
|
|
53303
|
-
const geminiAuthPath = (0,
|
|
53436
|
+
const geminiAuthPath = (0, import_path26.join)((0, import_os20.homedir)(), ".gemini", "oauth_creds.json");
|
|
53304
53437
|
if (verbose) {
|
|
53305
53438
|
spinner.info(source_default.dim(` Trying ${geminiAuthPath}...`));
|
|
53306
53439
|
}
|
|
53307
|
-
if ((0,
|
|
53440
|
+
if ((0, import_fs27.existsSync)(geminiAuthPath)) {
|
|
53308
53441
|
try {
|
|
53309
|
-
const content = (0,
|
|
53442
|
+
const content = (0, import_fs27.readFileSync)(geminiAuthPath, "utf-8");
|
|
53310
53443
|
const authData = JSON.parse(content);
|
|
53311
53444
|
if (verbose) {
|
|
53312
53445
|
spinner.info(source_default.dim(` Found oauth_creds.json, checking tokens...`));
|
|
@@ -53407,13 +53540,13 @@ Source: ${credentialSource2}`));
|
|
|
53407
53540
|
let refreshToken;
|
|
53408
53541
|
let idToken;
|
|
53409
53542
|
let scope;
|
|
53410
|
-
const firebaseAuthPath = (0,
|
|
53543
|
+
const firebaseAuthPath = (0, import_path26.join)((0, import_os20.homedir)(), ".config", "configstore", "firebase-tools.json");
|
|
53411
53544
|
if (verbose) {
|
|
53412
53545
|
spinner.info(source_default.dim(` Trying ${firebaseAuthPath}...`));
|
|
53413
53546
|
}
|
|
53414
|
-
if ((0,
|
|
53547
|
+
if ((0, import_fs27.existsSync)(firebaseAuthPath)) {
|
|
53415
53548
|
try {
|
|
53416
|
-
const content = (0,
|
|
53549
|
+
const content = (0, import_fs27.readFileSync)(firebaseAuthPath, "utf-8");
|
|
53417
53550
|
const data = JSON.parse(content);
|
|
53418
53551
|
if (verbose) {
|
|
53419
53552
|
spinner.info(source_default.dim(` Found firebase-tools.json, checking tokens...`));
|
|
@@ -53513,13 +53646,13 @@ Source: ${credentialSource2}`));
|
|
|
53513
53646
|
spinner.info(source_default.dim(" Using access token from command line"));
|
|
53514
53647
|
}
|
|
53515
53648
|
} else {
|
|
53516
|
-
const cursorAuthPath = (0,
|
|
53649
|
+
const cursorAuthPath = (0, import_path26.join)((0, import_os20.homedir)(), ".cursor", "auth.json");
|
|
53517
53650
|
if (verbose) {
|
|
53518
53651
|
spinner.info(source_default.dim(` Trying ${cursorAuthPath}...`));
|
|
53519
53652
|
}
|
|
53520
|
-
if ((0,
|
|
53653
|
+
if ((0, import_fs27.existsSync)(cursorAuthPath)) {
|
|
53521
53654
|
try {
|
|
53522
|
-
const content = (0,
|
|
53655
|
+
const content = (0, import_fs27.readFileSync)(cursorAuthPath, "utf-8");
|
|
53523
53656
|
const authData = JSON.parse(content);
|
|
53524
53657
|
if (verbose) {
|
|
53525
53658
|
spinner.info(source_default.dim(` Found auth.json, checking tokens...`));
|
|
@@ -53792,7 +53925,7 @@ Source: ${credentialSource2}`));
|
|
|
53792
53925
|
Running: gal auth ${providerId}
|
|
53793
53926
|
`));
|
|
53794
53927
|
try {
|
|
53795
|
-
(0,
|
|
53928
|
+
(0, import_child_process9.execSync)(`node ${process.argv[1]} auth ${providerId}`, {
|
|
53796
53929
|
stdio: "inherit",
|
|
53797
53930
|
encoding: "utf-8",
|
|
53798
53931
|
timeout: 3e4,
|
|
@@ -53829,7 +53962,7 @@ Source: ${credentialSource2}`));
|
|
|
53829
53962
|
});
|
|
53830
53963
|
return auth;
|
|
53831
53964
|
}
|
|
53832
|
-
var import_http,
|
|
53965
|
+
var import_http, import_child_process9, import_os20, import_fs27, import_path26, import_readline3, CLI_CALLBACK_PORT, CLI_CALLBACK_PATH, cliVersion5, defaultApiUrl5;
|
|
53833
53966
|
var init_auth2 = __esm({
|
|
53834
53967
|
"src/commands/auth.ts"() {
|
|
53835
53968
|
"use strict";
|
|
@@ -53837,14 +53970,14 @@ var init_auth2 = __esm({
|
|
|
53837
53970
|
init_source();
|
|
53838
53971
|
init_ora();
|
|
53839
53972
|
import_http = require("http");
|
|
53840
|
-
|
|
53973
|
+
import_child_process9 = require("child_process");
|
|
53841
53974
|
init_config_manager();
|
|
53842
53975
|
init_constants();
|
|
53843
53976
|
init_CoreServiceProvider();
|
|
53844
53977
|
init_telemetry();
|
|
53845
53978
|
import_os20 = require("os");
|
|
53846
|
-
|
|
53847
|
-
|
|
53979
|
+
import_fs27 = require("fs");
|
|
53980
|
+
import_path26 = require("path");
|
|
53848
53981
|
init_hooks();
|
|
53849
53982
|
init_sync();
|
|
53850
53983
|
import_readline3 = require("readline");
|
|
@@ -53859,13 +53992,13 @@ var init_auth2 = __esm({
|
|
|
53859
53992
|
// src/commands/check.ts
|
|
53860
53993
|
function createCheckCommand() {
|
|
53861
53994
|
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) => {
|
|
53862
|
-
if (!(0,
|
|
53995
|
+
if (!(0, import_fs28.existsSync)(options.path)) {
|
|
53863
53996
|
console.error(source_default.red(`
|
|
53864
53997
|
Error: Path does not exist: ${options.path}
|
|
53865
53998
|
`));
|
|
53866
53999
|
process.exit(1);
|
|
53867
54000
|
}
|
|
53868
|
-
if (!(0,
|
|
54001
|
+
if (!(0, import_fs28.statSync)(options.path).isDirectory()) {
|
|
53869
54002
|
console.error(source_default.red(`
|
|
53870
54003
|
Error: Path is not a directory: ${options.path}
|
|
53871
54004
|
`));
|
|
@@ -53877,8 +54010,8 @@ Error: Path is not a directory: ${options.path}
|
|
|
53877
54010
|
});
|
|
53878
54011
|
const report = await checker.runAllChecks();
|
|
53879
54012
|
if (options.report) {
|
|
53880
|
-
const reportPath = (0,
|
|
53881
|
-
(0,
|
|
54013
|
+
const reportPath = (0, import_path27.join)(options.path, "gal-check-report.json");
|
|
54014
|
+
(0, import_fs28.writeFileSync)(reportPath, JSON.stringify(report, null, 2));
|
|
53882
54015
|
console.log(source_default.blue(`Report saved to: ${reportPath}`));
|
|
53883
54016
|
}
|
|
53884
54017
|
if (report.summary.blocked) {
|
|
@@ -53887,15 +54020,15 @@ Error: Path is not a directory: ${options.path}
|
|
|
53887
54020
|
});
|
|
53888
54021
|
return command;
|
|
53889
54022
|
}
|
|
53890
|
-
var
|
|
54023
|
+
var import_fs28, import_path27, import_child_process10, SECRET_PATTERNS, DANGEROUS_PATTERNS, FORBIDDEN_FILES, PreEnforcementChecker;
|
|
53891
54024
|
var init_check = __esm({
|
|
53892
54025
|
"src/commands/check.ts"() {
|
|
53893
54026
|
"use strict";
|
|
53894
54027
|
init_esm();
|
|
53895
54028
|
init_source();
|
|
53896
|
-
|
|
53897
|
-
|
|
53898
|
-
|
|
54029
|
+
import_fs28 = require("fs");
|
|
54030
|
+
import_path27 = require("path");
|
|
54031
|
+
import_child_process10 = require("child_process");
|
|
53899
54032
|
SECRET_PATTERNS = [
|
|
53900
54033
|
{
|
|
53901
54034
|
name: "AWS Access Key",
|
|
@@ -54021,14 +54154,14 @@ var init_check = __esm({
|
|
|
54021
54154
|
*/
|
|
54022
54155
|
getFilesToCheck() {
|
|
54023
54156
|
try {
|
|
54024
|
-
const staged = (0,
|
|
54157
|
+
const staged = (0, import_child_process10.execSync)("git diff --cached --name-only", {
|
|
54025
54158
|
cwd: this.projectPath,
|
|
54026
54159
|
encoding: "utf-8"
|
|
54027
54160
|
}).trim();
|
|
54028
54161
|
if (staged) {
|
|
54029
54162
|
return staged.split("\n").filter((f) => f.trim());
|
|
54030
54163
|
}
|
|
54031
|
-
const tracked = (0,
|
|
54164
|
+
const tracked = (0, import_child_process10.execSync)("git ls-files", {
|
|
54032
54165
|
cwd: this.projectPath,
|
|
54033
54166
|
encoding: "utf-8"
|
|
54034
54167
|
}).trim();
|
|
@@ -54046,10 +54179,10 @@ var init_check = __esm({
|
|
|
54046
54179
|
const scan = (currentDir, depth) => {
|
|
54047
54180
|
if (depth > maxDepth) return;
|
|
54048
54181
|
try {
|
|
54049
|
-
const entries = (0,
|
|
54182
|
+
const entries = (0, import_fs28.readdirSync)(currentDir, { withFileTypes: true });
|
|
54050
54183
|
for (const entry of entries) {
|
|
54051
|
-
const fullPath = (0,
|
|
54052
|
-
const relativePath = (0,
|
|
54184
|
+
const fullPath = (0, import_path27.join)(currentDir, entry.name);
|
|
54185
|
+
const relativePath = (0, import_path27.relative)(this.projectPath, fullPath);
|
|
54053
54186
|
if (entry.isDirectory()) {
|
|
54054
54187
|
if (!ignoreDirs.includes(entry.name)) {
|
|
54055
54188
|
scan(fullPath, depth + 1);
|
|
@@ -54069,10 +54202,10 @@ var init_check = __esm({
|
|
|
54069
54202
|
*/
|
|
54070
54203
|
async checkForSecrets(files) {
|
|
54071
54204
|
for (const file of files) {
|
|
54072
|
-
const fullPath = (0,
|
|
54073
|
-
if (!(0,
|
|
54205
|
+
const fullPath = (0, import_path27.join)(this.projectPath, file);
|
|
54206
|
+
if (!(0, import_fs28.existsSync)(fullPath) || !this.isTextFile(fullPath)) continue;
|
|
54074
54207
|
try {
|
|
54075
|
-
const content = (0,
|
|
54208
|
+
const content = (0, import_fs28.readFileSync)(fullPath, "utf-8");
|
|
54076
54209
|
const lines = content.split("\n");
|
|
54077
54210
|
for (const { name, pattern, severity, suggestion } of SECRET_PATTERNS) {
|
|
54078
54211
|
pattern.lastIndex = 0;
|
|
@@ -54104,13 +54237,13 @@ var init_check = __esm({
|
|
|
54104
54237
|
async checkForDangerousCommands(files) {
|
|
54105
54238
|
const scriptExtensions = [".sh", ".bash", ".zsh", ".ps1", ".bat", ".cmd"];
|
|
54106
54239
|
for (const file of files) {
|
|
54107
|
-
const fullPath = (0,
|
|
54108
|
-
if (!(0,
|
|
54240
|
+
const fullPath = (0, import_path27.join)(this.projectPath, file);
|
|
54241
|
+
if (!(0, import_fs28.existsSync)(fullPath)) continue;
|
|
54109
54242
|
const isScript = scriptExtensions.some((ext) => file.endsWith(ext));
|
|
54110
54243
|
const isConfig = file.includes("hook") || file.includes("command");
|
|
54111
54244
|
if (!isScript && !isConfig) continue;
|
|
54112
54245
|
try {
|
|
54113
|
-
const content = (0,
|
|
54246
|
+
const content = (0, import_fs28.readFileSync)(fullPath, "utf-8");
|
|
54114
54247
|
for (const { name, pattern, severity, suggestion } of DANGEROUS_PATTERNS) {
|
|
54115
54248
|
pattern.lastIndex = 0;
|
|
54116
54249
|
let match;
|
|
@@ -54148,7 +54281,7 @@ var init_check = __esm({
|
|
|
54148
54281
|
autoFixable: true,
|
|
54149
54282
|
autoFix: () => {
|
|
54150
54283
|
try {
|
|
54151
|
-
(0,
|
|
54284
|
+
(0, import_child_process10.execSync)(`git reset HEAD "${file}"`, { cwd: this.projectPath });
|
|
54152
54285
|
} catch {
|
|
54153
54286
|
}
|
|
54154
54287
|
}
|
|
@@ -54163,14 +54296,14 @@ var init_check = __esm({
|
|
|
54163
54296
|
async checkAgentConfigs() {
|
|
54164
54297
|
const configDirs = [".claude", ".cursor", ".gemini", ".codex", ".windsurf"];
|
|
54165
54298
|
for (const dir of configDirs) {
|
|
54166
|
-
const dirPath = (0,
|
|
54167
|
-
if (!(0,
|
|
54299
|
+
const dirPath = (0, import_path27.join)(this.projectPath, dir);
|
|
54300
|
+
if (!(0, import_fs28.existsSync)(dirPath)) continue;
|
|
54168
54301
|
const files = this.scanDirectory(dirPath, 2);
|
|
54169
54302
|
for (const file of files) {
|
|
54170
|
-
const fullPath = (0,
|
|
54171
|
-
if (!(0,
|
|
54303
|
+
const fullPath = (0, import_path27.join)(this.projectPath, file);
|
|
54304
|
+
if (!(0, import_fs28.existsSync)(fullPath)) continue;
|
|
54172
54305
|
try {
|
|
54173
|
-
const content = (0,
|
|
54306
|
+
const content = (0, import_fs28.readFileSync)(fullPath, "utf-8");
|
|
54174
54307
|
if (content.includes('"allowAll": true') || content.includes("allowAll: true")) {
|
|
54175
54308
|
this.issues.push({
|
|
54176
54309
|
severity: "high",
|
|
@@ -54210,7 +54343,7 @@ var init_check = __esm({
|
|
|
54210
54343
|
file.replace("src/", "src/__tests__/").replace(/\.(ts|tsx|js|jsx)$/, ".test.$1")
|
|
54211
54344
|
];
|
|
54212
54345
|
const hasTest = testVariants.some(
|
|
54213
|
-
(testFile) => (0,
|
|
54346
|
+
(testFile) => (0, import_fs28.existsSync)((0, import_path27.join)(this.projectPath, testFile))
|
|
54214
54347
|
);
|
|
54215
54348
|
if (!hasTest) {
|
|
54216
54349
|
this.issues.push({
|
|
@@ -59851,13 +59984,21 @@ Installing hooks for: ${platforms.join(", ")}`));
|
|
|
59851
59984
|
process.exit(1);
|
|
59852
59985
|
}
|
|
59853
59986
|
});
|
|
59854
|
-
sdlcCommand.command("set <level>").description("Set native SDLC enforcement mode (off, warn, block)").option("--reason <reason>", "Reason to include in the audit trail").option("--json", "Output as JSON").action(async (level, options) => {
|
|
59987
|
+
sdlcCommand.command("set <level>").description("Set native SDLC enforcement mode (off, warn, block)").option("--reason <reason>", "Reason to include in the audit trail").option("--warn-duration-days <days>", "Days in warn mode before auto-escalating to block (0 = no auto-escalation)").option("--json", "Output as JSON").action(async (level, options) => {
|
|
59855
59988
|
if (!["off", "warn", "block"].includes(level)) {
|
|
59856
59989
|
console.error(source_default.red("Invalid level. Use one of: off, warn, block"));
|
|
59857
59990
|
process.exit(1);
|
|
59858
59991
|
}
|
|
59859
59992
|
const { authToken, orgName, apiUrl } = getAuthAndOrg2();
|
|
59860
59993
|
const spinner = options.json ? null : ora(`Setting SDLC enforcement mode to ${level}...`).start();
|
|
59994
|
+
let warnDurationDays;
|
|
59995
|
+
if (options.warnDurationDays !== void 0) {
|
|
59996
|
+
warnDurationDays = parseInt(options.warnDurationDays, 10);
|
|
59997
|
+
if (isNaN(warnDurationDays) || warnDurationDays < 0) {
|
|
59998
|
+
console.error(source_default.red("--warn-duration-days must be a non-negative integer"));
|
|
59999
|
+
process.exit(1);
|
|
60000
|
+
}
|
|
60001
|
+
}
|
|
59861
60002
|
try {
|
|
59862
60003
|
const res = await fetchApi3(
|
|
59863
60004
|
`${apiUrl}/organizations/${encodeURIComponent(orgName)}/enforcement/sdlc`,
|
|
@@ -59866,7 +60007,8 @@ Installing hooks for: ${platforms.join(", ")}`));
|
|
|
59866
60007
|
{
|
|
59867
60008
|
level,
|
|
59868
60009
|
enabled: level !== "off",
|
|
59869
|
-
...options.reason ? { reason: options.reason } : {}
|
|
60010
|
+
...options.reason ? { reason: options.reason } : {},
|
|
60011
|
+
...warnDurationDays !== void 0 ? { warnDurationDays } : {}
|
|
59870
60012
|
}
|
|
59871
60013
|
);
|
|
59872
60014
|
if (!res.ok) {
|
|
@@ -59880,8 +60022,11 @@ Installing hooks for: ${platforms.join(", ")}`));
|
|
|
59880
60022
|
return;
|
|
59881
60023
|
}
|
|
59882
60024
|
console.log(source_default.green(`
|
|
59883
|
-
Native SDLC enforcement updated to ${level} for ${orgName}
|
|
59884
|
-
|
|
60025
|
+
Native SDLC enforcement updated to ${level} for ${orgName}.`));
|
|
60026
|
+
if (level === "warn" && warnDurationDays && warnDurationDays > 0) {
|
|
60027
|
+
console.log(source_default.dim(` Warn period: ${warnDurationDays} day(s) before auto-escalating to block.`));
|
|
60028
|
+
}
|
|
60029
|
+
console.log();
|
|
59885
60030
|
} catch (error3) {
|
|
59886
60031
|
spinner?.stop();
|
|
59887
60032
|
const msg = error3 instanceof Error ? error3.message : String(error3);
|
|
@@ -59893,6 +60038,86 @@ Native SDLC enforcement updated to ${level} for ${orgName}.
|
|
|
59893
60038
|
process.exit(1);
|
|
59894
60039
|
}
|
|
59895
60040
|
});
|
|
60041
|
+
sdlcCommand.command("check").description("Check effective enforcement mode and warn or block accordingly").option("--login <login>", "Developer GitHub login (defaults to authenticated user)").option("--context <context>", "Description of the action being checked (shown in messages)").option("--json", "Output as JSON").action(async (options) => {
|
|
60042
|
+
const { authToken, orgName, apiUrl } = getAuthAndOrg2();
|
|
60043
|
+
try {
|
|
60044
|
+
const loginParam = options.login ? `?login=${encodeURIComponent(options.login)}` : "";
|
|
60045
|
+
const res = await fetchApi3(
|
|
60046
|
+
`${apiUrl}/organizations/${encodeURIComponent(orgName)}/enforcement/sdlc/mode${loginParam}`,
|
|
60047
|
+
authToken
|
|
60048
|
+
);
|
|
60049
|
+
if (!res.ok) {
|
|
60050
|
+
if (options.json) {
|
|
60051
|
+
console.log(JSON.stringify({ allowed: true, level: "off", reason: "API unavailable \u2014 fail open" }));
|
|
60052
|
+
}
|
|
60053
|
+
process.exit(0);
|
|
60054
|
+
return;
|
|
60055
|
+
}
|
|
60056
|
+
const data = await res.json();
|
|
60057
|
+
const { level, reason, isDeveloperOverride, isAutoEscalated } = data.resolved;
|
|
60058
|
+
const actionCtx = options.context ? ` (${options.context})` : "";
|
|
60059
|
+
if (options.json) {
|
|
60060
|
+
console.log(JSON.stringify({
|
|
60061
|
+
allowed: level !== "block",
|
|
60062
|
+
level,
|
|
60063
|
+
reason,
|
|
60064
|
+
isDeveloperOverride,
|
|
60065
|
+
isAutoEscalated,
|
|
60066
|
+
orgName,
|
|
60067
|
+
developerLogin: data.developerLogin
|
|
60068
|
+
}, null, 2));
|
|
60069
|
+
if (level === "block") {
|
|
60070
|
+
process.exit(1);
|
|
60071
|
+
}
|
|
60072
|
+
return;
|
|
60073
|
+
}
|
|
60074
|
+
if (level === "off") {
|
|
60075
|
+
process.exit(0);
|
|
60076
|
+
return;
|
|
60077
|
+
}
|
|
60078
|
+
if (level === "warn") {
|
|
60079
|
+
console.warn(source_default.yellow(`
|
|
60080
|
+
\u26A0 GAL SDLC Warning${actionCtx}`));
|
|
60081
|
+
console.warn(source_default.yellow(" You are working outside the SDLC workflow."));
|
|
60082
|
+
console.warn(source_default.dim(` You should be using the appropriate SDLC command (e.g., /sdlc:4-implement:run <issue>).`));
|
|
60083
|
+
console.warn(source_default.dim(` Organization: ${orgName}`));
|
|
60084
|
+
if (isDeveloperOverride) {
|
|
60085
|
+
console.warn(source_default.dim(` Note: A per-developer override is active.`));
|
|
60086
|
+
}
|
|
60087
|
+
if (isAutoEscalated) {
|
|
60088
|
+
console.warn(source_default.dim(` Note: The org warn period has elapsed \u2014 this will soon switch to block mode.`));
|
|
60089
|
+
}
|
|
60090
|
+
console.warn(source_default.dim(` You can continue, but your activity has been noted.
|
|
60091
|
+
`));
|
|
60092
|
+
process.exit(0);
|
|
60093
|
+
return;
|
|
60094
|
+
}
|
|
60095
|
+
if (level === "block") {
|
|
60096
|
+
console.error(source_default.red(`
|
|
60097
|
+
\u2717 GAL SDLC Enforcement \u2014 Operation Blocked${actionCtx}`));
|
|
60098
|
+
console.error(source_default.red(` You must use the SDLC workflow command for this type of work.`));
|
|
60099
|
+
console.error(source_default.dim(` Example: /sdlc:4-implement:run <issue-number>`));
|
|
60100
|
+
console.error(source_default.dim(` Organization: ${orgName}`));
|
|
60101
|
+
if (isDeveloperOverride) {
|
|
60102
|
+
console.error(source_default.dim(` Note: A per-developer override is active.`));
|
|
60103
|
+
}
|
|
60104
|
+
if (isAutoEscalated) {
|
|
60105
|
+
console.error(source_default.dim(` Note: The org warn period elapsed \u2014 enforcement has escalated to block.`));
|
|
60106
|
+
}
|
|
60107
|
+
console.error(source_default.dim(` Contact your org admin if you believe this is a mistake.
|
|
60108
|
+
`));
|
|
60109
|
+
process.exit(1);
|
|
60110
|
+
return;
|
|
60111
|
+
}
|
|
60112
|
+
process.exit(0);
|
|
60113
|
+
} catch (error3) {
|
|
60114
|
+
const msg = error3 instanceof Error ? error3.message : String(error3);
|
|
60115
|
+
if (options.json) {
|
|
60116
|
+
console.log(JSON.stringify({ allowed: true, level: "off", reason: `Error \u2014 fail open: ${msg}` }));
|
|
60117
|
+
}
|
|
60118
|
+
process.exit(0);
|
|
60119
|
+
}
|
|
60120
|
+
});
|
|
59896
60121
|
enforce.addCommand(sdlcCommand);
|
|
59897
60122
|
const workflowCommand = new Command("workflow").description("Manage workflow enforcement mode (background agents only)");
|
|
59898
60123
|
workflowCommand.command("status").description("Show the current workflow enforcement mode").option("--json", "Output as JSON").action(async (options) => {
|
|
@@ -60240,8 +60465,8 @@ async function fetchWithAuth(url, authToken) {
|
|
|
60240
60465
|
}
|
|
60241
60466
|
async function resolveOrgFromGit(basePath) {
|
|
60242
60467
|
try {
|
|
60243
|
-
const { execSync:
|
|
60244
|
-
const remote =
|
|
60468
|
+
const { execSync: execSync15 } = await import("node:child_process");
|
|
60469
|
+
const remote = execSync15("git remote get-url origin", { cwd: basePath, encoding: "utf-8" }).trim();
|
|
60245
60470
|
const sshMatch = remote.match(/:([^/]+)\//);
|
|
60246
60471
|
const httpsMatch = remote.match(/github\.com\/([^/]+)\//);
|
|
60247
60472
|
return sshMatch?.[1] || httpsMatch?.[1] || null;
|
|
@@ -60748,18 +60973,18 @@ Writing configs to ${outputDir}:
|
|
|
60748
60973
|
if (!fileName.includes(".")) {
|
|
60749
60974
|
fileName = `${fileName}${extension}`;
|
|
60750
60975
|
}
|
|
60751
|
-
const relativePath = categoryDir ? (0,
|
|
60752
|
-
const fullPath = (0,
|
|
60976
|
+
const relativePath = categoryDir ? (0, import_path28.join)(platformDir, categoryDir, fileName) : (0, import_path28.join)(platformDir, fileName);
|
|
60977
|
+
const fullPath = (0, import_path28.join)(outputDir, relativePath);
|
|
60753
60978
|
if (options.dryRun) {
|
|
60754
60979
|
console.log(source_default.cyan(" [dry-run]"), relativePath);
|
|
60755
60980
|
writtenFiles.push(relativePath);
|
|
60756
60981
|
continue;
|
|
60757
60982
|
}
|
|
60758
|
-
const dir = (0,
|
|
60759
|
-
if (!(0,
|
|
60760
|
-
(0,
|
|
60983
|
+
const dir = (0, import_path28.dirname)(fullPath);
|
|
60984
|
+
if (!(0, import_fs29.existsSync)(dir)) {
|
|
60985
|
+
(0, import_fs29.mkdirSync)(dir, { recursive: true });
|
|
60761
60986
|
}
|
|
60762
|
-
(0,
|
|
60987
|
+
(0, import_fs29.writeFileSync)(fullPath, file.content, "utf-8");
|
|
60763
60988
|
writtenFiles.push(relativePath);
|
|
60764
60989
|
console.log(source_default.green(" \u2713"), relativePath);
|
|
60765
60990
|
}
|
|
@@ -60820,7 +61045,7 @@ Files written to ${outputDir}`));
|
|
|
60820
61045
|
});
|
|
60821
61046
|
return command;
|
|
60822
61047
|
}
|
|
60823
|
-
var
|
|
61048
|
+
var import_fs29, import_path28, PLATFORM_DIRS4, CATEGORY_DIRS, FILE_EXTENSIONS;
|
|
60824
61049
|
var init_fetch = __esm({
|
|
60825
61050
|
"src/commands/fetch.ts"() {
|
|
60826
61051
|
"use strict";
|
|
@@ -60829,8 +61054,8 @@ var init_fetch = __esm({
|
|
|
60829
61054
|
init_ora();
|
|
60830
61055
|
init_config_manager();
|
|
60831
61056
|
init_CoreServiceProvider();
|
|
60832
|
-
|
|
60833
|
-
|
|
61057
|
+
import_fs29 = require("fs");
|
|
61058
|
+
import_path28 = require("path");
|
|
60834
61059
|
init_capability_checker();
|
|
60835
61060
|
init_dist2();
|
|
60836
61061
|
PLATFORM_DIRS4 = { ...PLATFORM_DIRECTORY_MAP };
|
|
@@ -61092,13 +61317,13 @@ function getGitEmail() {
|
|
|
61092
61317
|
}
|
|
61093
61318
|
async function getLocalEnforcementStatus() {
|
|
61094
61319
|
const { stat: stat5, readFile: readFile4 } = await import("node:fs/promises");
|
|
61095
|
-
const { join:
|
|
61320
|
+
const { join: join55 } = await import("node:path");
|
|
61096
61321
|
const platforms = [];
|
|
61097
61322
|
let version2 = "0.0.0";
|
|
61098
61323
|
let policyVersion = "0.0.0";
|
|
61099
61324
|
const platformDirs = [".claude", ".cursor", ".gemini", ".codex", ".windsurf"];
|
|
61100
61325
|
for (const dir of platformDirs) {
|
|
61101
|
-
const hookPath =
|
|
61326
|
+
const hookPath = join55(process.cwd(), dir, "hooks", "gal-safety-hook.py");
|
|
61102
61327
|
try {
|
|
61103
61328
|
await stat5(hookPath);
|
|
61104
61329
|
platforms.push(dir.replace(".", ""));
|
|
@@ -61111,7 +61336,7 @@ async function getLocalEnforcementStatus() {
|
|
|
61111
61336
|
}
|
|
61112
61337
|
}
|
|
61113
61338
|
try {
|
|
61114
|
-
const pkgPath =
|
|
61339
|
+
const pkgPath = join55(import_meta2.url.replace("file://", ""), "..", "..", "..", "package.json");
|
|
61115
61340
|
const pkg = JSON.parse(await readFile4(pkgPath, "utf-8"));
|
|
61116
61341
|
version2 = pkg.version || "0.1.0";
|
|
61117
61342
|
} catch {
|
|
@@ -61571,15 +61796,15 @@ Task not running: ${taskId}
|
|
|
61571
61796
|
});
|
|
61572
61797
|
return command;
|
|
61573
61798
|
}
|
|
61574
|
-
var
|
|
61799
|
+
var import_child_process11, import_fs30, import_path29, DEFAULT_CONFIG, TASK_TEMPLATES, HeadlessRunner;
|
|
61575
61800
|
var init_headless = __esm({
|
|
61576
61801
|
"src/commands/headless.ts"() {
|
|
61577
61802
|
"use strict";
|
|
61578
61803
|
init_esm();
|
|
61579
61804
|
init_source();
|
|
61580
|
-
|
|
61581
|
-
|
|
61582
|
-
|
|
61805
|
+
import_child_process11 = require("child_process");
|
|
61806
|
+
import_fs30 = require("fs");
|
|
61807
|
+
import_path29 = require("path");
|
|
61583
61808
|
DEFAULT_CONFIG = {
|
|
61584
61809
|
dataDir: ".gal/headless",
|
|
61585
61810
|
logDir: ".gal/headless/logs",
|
|
@@ -61633,23 +61858,23 @@ var init_headless = __esm({
|
|
|
61633
61858
|
* Ensure required directories exist
|
|
61634
61859
|
*/
|
|
61635
61860
|
ensureDirectories() {
|
|
61636
|
-
const dataDir = (0,
|
|
61637
|
-
const logDir = (0,
|
|
61638
|
-
if (!(0,
|
|
61639
|
-
(0,
|
|
61861
|
+
const dataDir = (0, import_path29.join)(this.projectPath, this.config.dataDir);
|
|
61862
|
+
const logDir = (0, import_path29.join)(this.projectPath, this.config.logDir);
|
|
61863
|
+
if (!(0, import_fs30.existsSync)(dataDir)) {
|
|
61864
|
+
(0, import_fs30.mkdirSync)(dataDir, { recursive: true });
|
|
61640
61865
|
}
|
|
61641
|
-
if (!(0,
|
|
61642
|
-
(0,
|
|
61866
|
+
if (!(0, import_fs30.existsSync)(logDir)) {
|
|
61867
|
+
(0, import_fs30.mkdirSync)(logDir, { recursive: true });
|
|
61643
61868
|
}
|
|
61644
61869
|
}
|
|
61645
61870
|
/**
|
|
61646
61871
|
* Load tasks from disk
|
|
61647
61872
|
*/
|
|
61648
61873
|
loadTasks() {
|
|
61649
|
-
const tasksFile = (0,
|
|
61650
|
-
if ((0,
|
|
61874
|
+
const tasksFile = (0, import_path29.join)(this.projectPath, this.config.dataDir, "tasks.json");
|
|
61875
|
+
if ((0, import_fs30.existsSync)(tasksFile)) {
|
|
61651
61876
|
try {
|
|
61652
|
-
const data = JSON.parse((0,
|
|
61877
|
+
const data = JSON.parse((0, import_fs30.readFileSync)(tasksFile, "utf-8"));
|
|
61653
61878
|
for (const task of data.tasks || []) {
|
|
61654
61879
|
this.tasks.set(task.id, {
|
|
61655
61880
|
...task,
|
|
@@ -61666,12 +61891,12 @@ var init_headless = __esm({
|
|
|
61666
61891
|
* Save tasks to disk
|
|
61667
61892
|
*/
|
|
61668
61893
|
saveTasks() {
|
|
61669
|
-
const tasksFile = (0,
|
|
61894
|
+
const tasksFile = (0, import_path29.join)(this.projectPath, this.config.dataDir, "tasks.json");
|
|
61670
61895
|
const data = {
|
|
61671
61896
|
tasks: Array.from(this.tasks.values()),
|
|
61672
61897
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
61673
61898
|
};
|
|
61674
|
-
(0,
|
|
61899
|
+
(0, import_fs30.writeFileSync)(tasksFile, JSON.stringify(data, null, 2));
|
|
61675
61900
|
}
|
|
61676
61901
|
/**
|
|
61677
61902
|
* Create a new task
|
|
@@ -61722,7 +61947,7 @@ var init_headless = __esm({
|
|
|
61722
61947
|
task.status = "running";
|
|
61723
61948
|
task.startedAt = /* @__PURE__ */ new Date();
|
|
61724
61949
|
this.saveTasks();
|
|
61725
|
-
const logFile = (0,
|
|
61950
|
+
const logFile = (0, import_path29.join)(
|
|
61726
61951
|
this.projectPath,
|
|
61727
61952
|
this.config.logDir,
|
|
61728
61953
|
`${task.id}_${Date.now()}.log`
|
|
@@ -61735,7 +61960,7 @@ var init_headless = __esm({
|
|
|
61735
61960
|
console.log(source_default.gray(` Log file: ${logFile}
|
|
61736
61961
|
`));
|
|
61737
61962
|
return new Promise((resolve11) => {
|
|
61738
|
-
const child = (0,
|
|
61963
|
+
const child = (0, import_child_process11.spawn)("sh", ["-c", task.command], {
|
|
61739
61964
|
cwd: this.projectPath,
|
|
61740
61965
|
env: {
|
|
61741
61966
|
...process.env,
|
|
@@ -61748,7 +61973,7 @@ var init_headless = __esm({
|
|
|
61748
61973
|
const logStream = (data, isError = false) => {
|
|
61749
61974
|
const text = data.toString();
|
|
61750
61975
|
const prefix = isError ? "[ERROR] " : "";
|
|
61751
|
-
(0,
|
|
61976
|
+
(0, import_fs30.appendFileSync)(logFile, `${(/* @__PURE__ */ new Date()).toISOString()} ${prefix}${text}`);
|
|
61752
61977
|
if (!task.output) task.output = "";
|
|
61753
61978
|
task.output += text;
|
|
61754
61979
|
};
|
|
@@ -61951,7 +62176,7 @@ var init_headless = __esm({
|
|
|
61951
62176
|
// src/commands/init.ts
|
|
61952
62177
|
function createInitCommand() {
|
|
61953
62178
|
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) => {
|
|
61954
|
-
const targetDirectory = (0,
|
|
62179
|
+
const targetDirectory = (0, import_path30.resolve)(options.directory || process.cwd());
|
|
61955
62180
|
if (options.remove) {
|
|
61956
62181
|
const result2 = removeInitializedDirectory(targetDirectory);
|
|
61957
62182
|
if (result2.removed) {
|
|
@@ -61979,13 +62204,13 @@ function createInitCommand() {
|
|
|
61979
62204
|
console.log(source_default.dim(`Registry: ${getSyncInitializationRegistryPath()}`));
|
|
61980
62205
|
});
|
|
61981
62206
|
}
|
|
61982
|
-
var
|
|
62207
|
+
var import_path30;
|
|
61983
62208
|
var init_init = __esm({
|
|
61984
62209
|
"src/commands/init.ts"() {
|
|
61985
62210
|
"use strict";
|
|
61986
62211
|
init_esm();
|
|
61987
62212
|
init_source();
|
|
61988
|
-
|
|
62213
|
+
import_path30 = require("path");
|
|
61989
62214
|
init_sync_initialization();
|
|
61990
62215
|
}
|
|
61991
62216
|
});
|
|
@@ -61993,18 +62218,18 @@ var init_init = __esm({
|
|
|
61993
62218
|
// src/commands/install.ts
|
|
61994
62219
|
function readClaudeSettings() {
|
|
61995
62220
|
try {
|
|
61996
|
-
if ((0,
|
|
61997
|
-
return JSON.parse((0,
|
|
62221
|
+
if ((0, import_fs31.existsSync)(SETTINGS_PATH2)) {
|
|
62222
|
+
return JSON.parse((0, import_fs31.readFileSync)(SETTINGS_PATH2, "utf-8"));
|
|
61998
62223
|
}
|
|
61999
62224
|
} catch {
|
|
62000
62225
|
}
|
|
62001
62226
|
return {};
|
|
62002
62227
|
}
|
|
62003
62228
|
function writeClaudeSettings(settings) {
|
|
62004
|
-
if (!(0,
|
|
62005
|
-
(0,
|
|
62229
|
+
if (!(0, import_fs31.existsSync)(CLAUDE_DIR2)) {
|
|
62230
|
+
(0, import_fs31.mkdirSync)(CLAUDE_DIR2, { recursive: true });
|
|
62006
62231
|
}
|
|
62007
|
-
(0,
|
|
62232
|
+
(0, import_fs31.writeFileSync)(SETTINGS_PATH2, JSON.stringify(settings, null, 2), "utf-8");
|
|
62008
62233
|
}
|
|
62009
62234
|
function hasMemorySyncHooks(settings) {
|
|
62010
62235
|
const preToolUse = settings.hooks?.PreToolUse || [];
|
|
@@ -62069,10 +62294,10 @@ function installMemorySyncHooks(upgrade) {
|
|
|
62069
62294
|
};
|
|
62070
62295
|
}
|
|
62071
62296
|
function injectClaudeMdTemplate(projectDir, upgrade) {
|
|
62072
|
-
const claudeMdPath = (0,
|
|
62297
|
+
const claudeMdPath = (0, import_path31.join)(projectDir, "CLAUDE.md");
|
|
62073
62298
|
const result = { injected: false, upgraded: false, path: claudeMdPath };
|
|
62074
|
-
if ((0,
|
|
62075
|
-
const content = (0,
|
|
62299
|
+
if ((0, import_fs31.existsSync)(claudeMdPath)) {
|
|
62300
|
+
const content = (0, import_fs31.readFileSync)(claudeMdPath, "utf-8");
|
|
62076
62301
|
if (content.includes(CLAUDE_MD_MARKER_START)) {
|
|
62077
62302
|
if (!upgrade) {
|
|
62078
62303
|
return result;
|
|
@@ -62081,16 +62306,16 @@ function injectClaudeMdTemplate(projectDir, upgrade) {
|
|
|
62081
62306
|
`${escapeRegex2(CLAUDE_MD_MARKER_START)}[\\s\\S]*?${escapeRegex2(CLAUDE_MD_MARKER_END)}`
|
|
62082
62307
|
);
|
|
62083
62308
|
const newContent2 = content.replace(regex2, CLAUDE_MD_TEMPLATE);
|
|
62084
|
-
(0,
|
|
62309
|
+
(0, import_fs31.writeFileSync)(claudeMdPath, newContent2, "utf-8");
|
|
62085
62310
|
result.upgraded = true;
|
|
62086
62311
|
return result;
|
|
62087
62312
|
}
|
|
62088
62313
|
const newContent = content.trimEnd() + "\n\n" + CLAUDE_MD_TEMPLATE + "\n";
|
|
62089
|
-
(0,
|
|
62314
|
+
(0, import_fs31.writeFileSync)(claudeMdPath, newContent, "utf-8");
|
|
62090
62315
|
result.injected = true;
|
|
62091
62316
|
return result;
|
|
62092
62317
|
}
|
|
62093
|
-
(0,
|
|
62318
|
+
(0, import_fs31.writeFileSync)(claudeMdPath, CLAUDE_MD_TEMPLATE + "\n", "utf-8");
|
|
62094
62319
|
result.injected = true;
|
|
62095
62320
|
return result;
|
|
62096
62321
|
}
|
|
@@ -62222,15 +62447,15 @@ function createInstallCommand() {
|
|
|
62222
62447
|
}
|
|
62223
62448
|
});
|
|
62224
62449
|
}
|
|
62225
|
-
var
|
|
62450
|
+
var import_fs31, import_path31, import_os21, INSTALL_METHODS, CLAUDE_DIR2, SETTINGS_PATH2, MEMORY_HOOK_VERSION, MEMORY_HOOK_MARKER, CLAUDE_MD_MARKER_START, CLAUDE_MD_MARKER_END, CLAUDE_MD_TEMPLATE;
|
|
62226
62451
|
var init_install2 = __esm({
|
|
62227
62452
|
"src/commands/install.ts"() {
|
|
62228
62453
|
"use strict";
|
|
62229
62454
|
init_esm();
|
|
62230
62455
|
init_source();
|
|
62231
62456
|
init_ora();
|
|
62232
|
-
|
|
62233
|
-
|
|
62457
|
+
import_fs31 = require("fs");
|
|
62458
|
+
import_path31 = require("path");
|
|
62234
62459
|
import_os21 = require("os");
|
|
62235
62460
|
init_install();
|
|
62236
62461
|
init_org_config_upgrade();
|
|
@@ -62242,8 +62467,8 @@ var init_install2 = __esm({
|
|
|
62242
62467
|
"native",
|
|
62243
62468
|
"unknown"
|
|
62244
62469
|
];
|
|
62245
|
-
CLAUDE_DIR2 = (0,
|
|
62246
|
-
SETTINGS_PATH2 = (0,
|
|
62470
|
+
CLAUDE_DIR2 = (0, import_path31.join)((0, import_os21.homedir)(), ".claude");
|
|
62471
|
+
SETTINGS_PATH2 = (0, import_path31.join)(CLAUDE_DIR2, "settings.json");
|
|
62247
62472
|
MEMORY_HOOK_VERSION = "1.0.0";
|
|
62248
62473
|
MEMORY_HOOK_MARKER = "gal-memory-sync";
|
|
62249
62474
|
CLAUDE_MD_MARKER_START = "<!-- GAL_SHARED_MEMORY_START -->";
|
|
@@ -62422,7 +62647,7 @@ if __name__ == '__main__':
|
|
|
62422
62647
|
`;
|
|
62423
62648
|
}
|
|
62424
62649
|
function createJoinCommand() {
|
|
62425
|
-
const
|
|
62650
|
+
const join55 = 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) => {
|
|
62426
62651
|
const spinner = ora();
|
|
62427
62652
|
if (!options.code) {
|
|
62428
62653
|
console.log(source_default.bold("\nGAL Developer Onboarding\n"));
|
|
@@ -62538,7 +62763,7 @@ Error: ${useResult.error || "Unknown error"}`));
|
|
|
62538
62763
|
process.exit(1);
|
|
62539
62764
|
}
|
|
62540
62765
|
});
|
|
62541
|
-
return
|
|
62766
|
+
return join55;
|
|
62542
62767
|
}
|
|
62543
62768
|
var import_node_os5, import_node_child_process2, import_node_crypto3, import_promises6, import_node_path4, defaultApiUrl9;
|
|
62544
62769
|
var init_join = __esm({
|
|
@@ -62833,8 +63058,8 @@ var init_maintain = __esm({
|
|
|
62833
63058
|
// src/commands/sync-memory.ts
|
|
62834
63059
|
function readSyncState2() {
|
|
62835
63060
|
try {
|
|
62836
|
-
if ((0,
|
|
62837
|
-
return JSON.parse((0,
|
|
63061
|
+
if ((0, import_fs32.existsSync)(SYNC_STATE_FILE)) {
|
|
63062
|
+
return JSON.parse((0, import_fs32.readFileSync)(SYNC_STATE_FILE, "utf-8"));
|
|
62838
63063
|
}
|
|
62839
63064
|
} catch {
|
|
62840
63065
|
}
|
|
@@ -62842,10 +63067,10 @@ function readSyncState2() {
|
|
|
62842
63067
|
}
|
|
62843
63068
|
function writeSyncState2(state) {
|
|
62844
63069
|
try {
|
|
62845
|
-
if (!(0,
|
|
62846
|
-
(0,
|
|
63070
|
+
if (!(0, import_fs32.existsSync)(SYNC_STATE_DIR)) {
|
|
63071
|
+
(0, import_fs32.mkdirSync)(SYNC_STATE_DIR, { recursive: true });
|
|
62847
63072
|
}
|
|
62848
|
-
(0,
|
|
63073
|
+
(0, import_fs32.writeFileSync)(SYNC_STATE_FILE, JSON.stringify(state, null, 2), "utf-8");
|
|
62849
63074
|
} catch {
|
|
62850
63075
|
}
|
|
62851
63076
|
}
|
|
@@ -62876,13 +63101,13 @@ function resolveAuthToken() {
|
|
|
62876
63101
|
}
|
|
62877
63102
|
function getLocalMemoryPath() {
|
|
62878
63103
|
const cwd = process.cwd();
|
|
62879
|
-
const claudeMemoryDir = (0,
|
|
62880
|
-
return (0,
|
|
63104
|
+
const claudeMemoryDir = (0, import_path32.join)(cwd, ".claude", "memory");
|
|
63105
|
+
return (0, import_path32.join)(claudeMemoryDir, "MEMORY.md");
|
|
62881
63106
|
}
|
|
62882
63107
|
function readMemoryEntries(filePath) {
|
|
62883
|
-
if (!(0,
|
|
63108
|
+
if (!(0, import_fs32.existsSync)(filePath)) return [];
|
|
62884
63109
|
try {
|
|
62885
|
-
const content = (0,
|
|
63110
|
+
const content = (0, import_fs32.readFileSync)(filePath, "utf-8");
|
|
62886
63111
|
return content.split(/\n\n+/).map((e) => e.trim()).filter((e) => e.length > 0);
|
|
62887
63112
|
} catch {
|
|
62888
63113
|
return [];
|
|
@@ -62924,11 +63149,11 @@ async function pullMemory(org, repo) {
|
|
|
62924
63149
|
writeSyncState2(state);
|
|
62925
63150
|
return;
|
|
62926
63151
|
}
|
|
62927
|
-
const memoryDir = (0,
|
|
62928
|
-
if (!(0,
|
|
62929
|
-
(0,
|
|
63152
|
+
const memoryDir = (0, import_path32.join)(process.cwd(), ".claude", "memory");
|
|
63153
|
+
if (!(0, import_fs32.existsSync)(memoryDir)) {
|
|
63154
|
+
(0, import_fs32.mkdirSync)(memoryDir, { recursive: true });
|
|
62930
63155
|
}
|
|
62931
|
-
const existingContent = (0,
|
|
63156
|
+
const existingContent = (0, import_fs32.existsSync)(memoryPath) ? (0, import_fs32.readFileSync)(memoryPath, "utf-8").trimEnd() : "";
|
|
62932
63157
|
const newContent = newEntries.map((entry) => {
|
|
62933
63158
|
const source = entry.source ? ` (from ${entry.source})` : "";
|
|
62934
63159
|
return `${entry.content}${source} ${GAL_SYNC_MARKER}`;
|
|
@@ -62938,7 +63163,7 @@ async function pullMemory(org, repo) {
|
|
|
62938
63163
|
${newContent}
|
|
62939
63164
|
` : `${newContent}
|
|
62940
63165
|
`;
|
|
62941
|
-
(0,
|
|
63166
|
+
(0, import_fs32.writeFileSync)(memoryPath, finalContent, "utf-8");
|
|
62942
63167
|
state.lastPullTimestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
62943
63168
|
writeSyncState2(state);
|
|
62944
63169
|
} catch {
|
|
@@ -62968,8 +63193,8 @@ async function pushMemory(org, repo, files) {
|
|
|
62968
63193
|
if (files && files.length > 0) {
|
|
62969
63194
|
for (const file of files) {
|
|
62970
63195
|
try {
|
|
62971
|
-
if (!(0,
|
|
62972
|
-
const stat5 = (0,
|
|
63196
|
+
if (!(0, import_fs32.existsSync)(file)) continue;
|
|
63197
|
+
const stat5 = (0, import_fs32.statSync)(file);
|
|
62973
63198
|
const fiveMinAgo = Date.now() - 5 * 60 * 1e3;
|
|
62974
63199
|
if (stat5.mtimeMs < fiveMinAgo) continue;
|
|
62975
63200
|
if (stat5.size > 5e4) continue;
|
|
@@ -63040,20 +63265,20 @@ function createSyncMemoryCommand() {
|
|
|
63040
63265
|
process.exit(0);
|
|
63041
63266
|
});
|
|
63042
63267
|
}
|
|
63043
|
-
var
|
|
63268
|
+
var import_fs32, import_path32, import_os22, SYNC_TIMEOUT_MS, GAL_SYNC_MARKER, SYNC_STATE_DIR, SYNC_STATE_FILE, defaultApiUrl10;
|
|
63044
63269
|
var init_sync_memory = __esm({
|
|
63045
63270
|
"src/commands/sync-memory.ts"() {
|
|
63046
63271
|
"use strict";
|
|
63047
63272
|
init_esm();
|
|
63048
|
-
|
|
63049
|
-
|
|
63273
|
+
import_fs32 = require("fs");
|
|
63274
|
+
import_path32 = require("path");
|
|
63050
63275
|
import_os22 = require("os");
|
|
63051
63276
|
init_config_manager();
|
|
63052
63277
|
init_constants();
|
|
63053
63278
|
SYNC_TIMEOUT_MS = 150;
|
|
63054
63279
|
GAL_SYNC_MARKER = "<!-- gal-synced -->";
|
|
63055
|
-
SYNC_STATE_DIR = (0,
|
|
63056
|
-
SYNC_STATE_FILE = (0,
|
|
63280
|
+
SYNC_STATE_DIR = (0, import_path32.join)((0, import_os22.homedir)(), ".gal", "memory-sync");
|
|
63281
|
+
SYNC_STATE_FILE = (0, import_path32.join)(SYNC_STATE_DIR, "last-sync.json");
|
|
63057
63282
|
defaultApiUrl10 = constants_default[1];
|
|
63058
63283
|
}
|
|
63059
63284
|
});
|
|
@@ -63093,10 +63318,10 @@ function parseMcpJsonRpcBody(body) {
|
|
|
63093
63318
|
return null;
|
|
63094
63319
|
}
|
|
63095
63320
|
function readMcpConfig(mcpPath) {
|
|
63096
|
-
if (!(0,
|
|
63321
|
+
if (!(0, import_fs33.existsSync)(mcpPath)) {
|
|
63097
63322
|
return { mcpServers: {} };
|
|
63098
63323
|
}
|
|
63099
|
-
const raw = (0,
|
|
63324
|
+
const raw = (0, import_fs33.readFileSync)(mcpPath, "utf-8");
|
|
63100
63325
|
const parsed = JSON.parse(raw);
|
|
63101
63326
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
63102
63327
|
throw new Error(`${mcpPath} must be a JSON object`);
|
|
@@ -63152,11 +63377,11 @@ async function postMcpJsonRpc(endpoint, authToken, method, params, timeoutMs) {
|
|
|
63152
63377
|
}
|
|
63153
63378
|
async function runMcpDoctor(options = {}) {
|
|
63154
63379
|
const config2 = ConfigManager.load();
|
|
63155
|
-
const directory = (0,
|
|
63380
|
+
const directory = (0, import_path33.resolve)(options.directory || process.cwd());
|
|
63156
63381
|
const serverName = options.serverName || DEFAULT_SERVER_NAME;
|
|
63157
63382
|
const fallbackApiUrl = resolveApiUrl2(options.apiUrl || config2.apiUrl || defaultApiUrl11);
|
|
63158
63383
|
let endpoint = buildMcpUrl(fallbackApiUrl);
|
|
63159
|
-
const mcpPath = (0,
|
|
63384
|
+
const mcpPath = (0, import_path33.join)(directory, ".mcp.json");
|
|
63160
63385
|
const authToken = options.authToken ?? config2.authToken;
|
|
63161
63386
|
const timeoutMs = options.timeoutMs ?? 1e4;
|
|
63162
63387
|
const result = {
|
|
@@ -63307,11 +63532,11 @@ MCP is healthy. ${result.toolsCount} GAL tools are available.
|
|
|
63307
63532
|
}
|
|
63308
63533
|
function createSetupCommand() {
|
|
63309
63534
|
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) => {
|
|
63310
|
-
const directory = (0,
|
|
63535
|
+
const directory = (0, import_path33.resolve)(options.dir || process.cwd());
|
|
63311
63536
|
const serverName = options.serverName || DEFAULT_SERVER_NAME;
|
|
63312
63537
|
const config2 = ConfigManager.load();
|
|
63313
63538
|
const apiUrl = resolveApiUrl2(options.apiUrl || config2.apiUrl || defaultApiUrl11);
|
|
63314
|
-
const mcpPath = (0,
|
|
63539
|
+
const mcpPath = (0, import_path33.join)(directory, ".mcp.json");
|
|
63315
63540
|
let existing = { mcpServers: {} };
|
|
63316
63541
|
try {
|
|
63317
63542
|
existing = readMcpConfig(mcpPath);
|
|
@@ -63320,8 +63545,8 @@ function createSetupCommand() {
|
|
|
63320
63545
|
process.exit(1);
|
|
63321
63546
|
}
|
|
63322
63547
|
const next = upsertHostedGalServer(existing, serverName, apiUrl);
|
|
63323
|
-
(0,
|
|
63324
|
-
(0,
|
|
63548
|
+
(0, import_fs33.mkdirSync)(directory, { recursive: true });
|
|
63549
|
+
(0, import_fs33.writeFileSync)(mcpPath, JSON.stringify(next, null, 2) + "\n", "utf-8");
|
|
63325
63550
|
console.log(source_default.green(`\u2713 Updated ${mcpPath}`));
|
|
63326
63551
|
console.log(source_default.dim(` mcpServers.${serverName}.url = ${buildMcpUrl(apiUrl)}
|
|
63327
63552
|
`));
|
|
@@ -63370,15 +63595,15 @@ function createDoctorCommand() {
|
|
|
63370
63595
|
function createMcpCommand() {
|
|
63371
63596
|
return new Command("mcp").description("Set up and validate GAL hosted MCP connectivity").addCommand(createSetupCommand()).addCommand(createDoctorCommand()).addCommand(createSyncMemoryCommand());
|
|
63372
63597
|
}
|
|
63373
|
-
var
|
|
63598
|
+
var import_fs33, import_path33, DEFAULT_SERVER_NAME, defaultApiUrl11;
|
|
63374
63599
|
var init_mcp = __esm({
|
|
63375
63600
|
"src/commands/mcp.ts"() {
|
|
63376
63601
|
"use strict";
|
|
63377
63602
|
init_esm();
|
|
63378
63603
|
init_source();
|
|
63379
63604
|
init_ora();
|
|
63380
|
-
|
|
63381
|
-
|
|
63605
|
+
import_fs33 = require("fs");
|
|
63606
|
+
import_path33 = require("path");
|
|
63382
63607
|
init_config_manager();
|
|
63383
63608
|
init_constants();
|
|
63384
63609
|
init_sync_memory();
|
|
@@ -63390,12 +63615,12 @@ var init_mcp = __esm({
|
|
|
63390
63615
|
// src/commands/memory.ts
|
|
63391
63616
|
function parseClaudeMemoryFile(filePath) {
|
|
63392
63617
|
try {
|
|
63393
|
-
const raw = (0,
|
|
63618
|
+
const raw = (0, import_fs34.readFileSync)(filePath, "utf-8");
|
|
63394
63619
|
const frontmatterMatch = raw.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
|
|
63395
63620
|
if (!frontmatterMatch) {
|
|
63396
63621
|
return {
|
|
63397
|
-
name: (0,
|
|
63398
|
-
description: (0,
|
|
63622
|
+
name: (0, import_path34.basename)(filePath, ".md"),
|
|
63623
|
+
description: (0, import_path34.basename)(filePath, ".md").replace(/[-_]/g, " "),
|
|
63399
63624
|
type: "project",
|
|
63400
63625
|
content: raw.trim(),
|
|
63401
63626
|
source: "claude"
|
|
@@ -63409,8 +63634,8 @@ function parseClaudeMemoryFile(filePath) {
|
|
|
63409
63634
|
const memType = getType?.[1]?.trim();
|
|
63410
63635
|
const validTypes = ["user", "feedback", "project", "reference"];
|
|
63411
63636
|
return {
|
|
63412
|
-
name: getName?.[1]?.trim() || (0,
|
|
63413
|
-
description: getDesc?.[1]?.trim() || (0,
|
|
63637
|
+
name: getName?.[1]?.trim() || (0, import_path34.basename)(filePath, ".md"),
|
|
63638
|
+
description: getDesc?.[1]?.trim() || (0, import_path34.basename)(filePath, ".md").replace(/[-_]/g, " "),
|
|
63414
63639
|
type: validTypes.includes(memType) ? memType : "project",
|
|
63415
63640
|
content: body,
|
|
63416
63641
|
source: "claude",
|
|
@@ -63424,22 +63649,22 @@ function discoverMemoryFiles(projectRoot, platform5, includeGlobal) {
|
|
|
63424
63649
|
const files = [];
|
|
63425
63650
|
const pattern = PLATFORM_PATTERNS[platform5];
|
|
63426
63651
|
if (pattern.memoryDir) {
|
|
63427
|
-
const memDir = (0,
|
|
63428
|
-
if ((0,
|
|
63652
|
+
const memDir = (0, import_path34.join)(projectRoot, pattern.directory, pattern.memoryDir);
|
|
63653
|
+
if ((0, import_fs34.existsSync)(memDir) && (0, import_fs34.statSync)(memDir).isDirectory()) {
|
|
63429
63654
|
scanMemoryDir(memDir, projectRoot, files, false);
|
|
63430
63655
|
}
|
|
63431
63656
|
}
|
|
63432
63657
|
if (includeGlobal) {
|
|
63433
63658
|
const home = (0, import_os23.homedir)();
|
|
63434
63659
|
if (platform5 === "claude") {
|
|
63435
|
-
const projectsDir = (0,
|
|
63436
|
-
if ((0,
|
|
63660
|
+
const projectsDir = (0, import_path34.join)(home, ".claude", "projects");
|
|
63661
|
+
if ((0, import_fs34.existsSync)(projectsDir)) {
|
|
63437
63662
|
try {
|
|
63438
|
-
const projectDirs = (0,
|
|
63663
|
+
const projectDirs = (0, import_fs34.readdirSync)(projectsDir, { withFileTypes: true });
|
|
63439
63664
|
for (const projDir of projectDirs) {
|
|
63440
63665
|
if (!projDir.isDirectory()) continue;
|
|
63441
|
-
const memDir = (0,
|
|
63442
|
-
if ((0,
|
|
63666
|
+
const memDir = (0, import_path34.join)(projectsDir, projDir.name, "memory");
|
|
63667
|
+
if ((0, import_fs34.existsSync)(memDir) && (0, import_fs34.statSync)(memDir).isDirectory()) {
|
|
63443
63668
|
scanMemoryDir(memDir, home, files, true);
|
|
63444
63669
|
}
|
|
63445
63670
|
}
|
|
@@ -63447,8 +63672,8 @@ function discoverMemoryFiles(projectRoot, platform5, includeGlobal) {
|
|
|
63447
63672
|
}
|
|
63448
63673
|
}
|
|
63449
63674
|
} else if (platform5 === "windsurf") {
|
|
63450
|
-
const memoriesDir = (0,
|
|
63451
|
-
if ((0,
|
|
63675
|
+
const memoriesDir = (0, import_path34.join)(home, ".codeium", "windsurf", "memories");
|
|
63676
|
+
if ((0, import_fs34.existsSync)(memoriesDir)) {
|
|
63452
63677
|
scanMemoryDir(memoriesDir, home, files, true);
|
|
63453
63678
|
}
|
|
63454
63679
|
}
|
|
@@ -63457,16 +63682,16 @@ function discoverMemoryFiles(projectRoot, platform5, includeGlobal) {
|
|
|
63457
63682
|
}
|
|
63458
63683
|
function scanMemoryDir(dir, rootDir, files, isGlobal) {
|
|
63459
63684
|
try {
|
|
63460
|
-
const entries = (0,
|
|
63685
|
+
const entries = (0, import_fs34.readdirSync)(dir, { withFileTypes: true });
|
|
63461
63686
|
for (const entry of entries) {
|
|
63462
|
-
const fullPath = (0,
|
|
63687
|
+
const fullPath = (0, import_path34.join)(dir, entry.name);
|
|
63463
63688
|
if (entry.isDirectory()) {
|
|
63464
63689
|
scanMemoryDir(fullPath, rootDir, files, isGlobal);
|
|
63465
63690
|
} else if (entry.isFile() && (entry.name.endsWith(".md") || entry.name.endsWith(".json"))) {
|
|
63466
63691
|
if (entry.name === "MEMORY.md") continue;
|
|
63467
63692
|
files.push({
|
|
63468
63693
|
path: fullPath,
|
|
63469
|
-
relativePath: (0,
|
|
63694
|
+
relativePath: (0, import_path34.relative)(rootDir, fullPath),
|
|
63470
63695
|
isGlobal
|
|
63471
63696
|
});
|
|
63472
63697
|
}
|
|
@@ -63551,9 +63776,9 @@ Notes:
|
|
|
63551
63776
|
mem = parseClaudeMemoryFile(file.path);
|
|
63552
63777
|
} else {
|
|
63553
63778
|
try {
|
|
63554
|
-
const content = (0,
|
|
63779
|
+
const content = (0, import_fs34.readFileSync)(file.path, "utf-8");
|
|
63555
63780
|
mem = {
|
|
63556
|
-
name: (0,
|
|
63781
|
+
name: (0, import_path34.basename)(file.path, ".md").replace(/[-_]/g, "-"),
|
|
63557
63782
|
description: `Imported from ${source}: ${file.relativePath}`,
|
|
63558
63783
|
type: "project",
|
|
63559
63784
|
content: content.trim(),
|
|
@@ -63670,14 +63895,14 @@ Notes:
|
|
|
63670
63895
|
});
|
|
63671
63896
|
return command;
|
|
63672
63897
|
}
|
|
63673
|
-
var
|
|
63898
|
+
var import_fs34, import_path34, import_os23;
|
|
63674
63899
|
var init_memory2 = __esm({
|
|
63675
63900
|
"src/commands/memory.ts"() {
|
|
63676
63901
|
"use strict";
|
|
63677
63902
|
init_esm();
|
|
63678
63903
|
init_source();
|
|
63679
|
-
|
|
63680
|
-
|
|
63904
|
+
import_fs34 = require("fs");
|
|
63905
|
+
import_path34 = require("path");
|
|
63681
63906
|
import_os23 = require("os");
|
|
63682
63907
|
init_dist2();
|
|
63683
63908
|
init_project_detection();
|
|
@@ -64204,21 +64429,21 @@ var init_policy = __esm({
|
|
|
64204
64429
|
async function readLocalConfig() {
|
|
64205
64430
|
const projectRoot = findProjectRoot();
|
|
64206
64431
|
const canonicalSources = [
|
|
64207
|
-
{ path: (0,
|
|
64208
|
-
{ path: (0,
|
|
64432
|
+
{ path: (0, import_path35.join)(projectRoot, ".gal", "config.yaml"), label: ".gal/config.yaml" },
|
|
64433
|
+
{ path: (0, import_path35.join)((0, import_os24.homedir)(), ".gal", "config.yaml"), label: "~/.gal/config.yaml" }
|
|
64209
64434
|
];
|
|
64210
64435
|
for (const source of canonicalSources) {
|
|
64211
|
-
if (!(0,
|
|
64436
|
+
if (!(0, import_fs35.existsSync)(source.path)) continue;
|
|
64212
64437
|
try {
|
|
64213
|
-
const content = (0,
|
|
64438
|
+
const content = (0, import_fs35.readFileSync)(source.path, "utf-8");
|
|
64214
64439
|
const config2 = (0, import_yaml3.parse)(content);
|
|
64215
64440
|
return config2;
|
|
64216
64441
|
} catch (error3) {
|
|
64217
64442
|
console.warn(`Failed to parse ${source.label}:`, error3);
|
|
64218
64443
|
}
|
|
64219
64444
|
}
|
|
64220
|
-
const claudeDir = (0,
|
|
64221
|
-
if (!(0,
|
|
64445
|
+
const claudeDir = (0, import_path35.join)(projectRoot, ".claude");
|
|
64446
|
+
if (!(0, import_fs35.existsSync)(claudeDir)) {
|
|
64222
64447
|
return null;
|
|
64223
64448
|
}
|
|
64224
64449
|
return constructConfigFromClaudeDir(claudeDir);
|
|
@@ -64231,10 +64456,10 @@ function constructConfigFromClaudeDir(claudeDir) {
|
|
|
64231
64456
|
hash: "",
|
|
64232
64457
|
syncedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
64233
64458
|
};
|
|
64234
|
-
const settingsPath = (0,
|
|
64235
|
-
if ((0,
|
|
64459
|
+
const settingsPath = (0, import_path35.join)(claudeDir, "settings.json");
|
|
64460
|
+
if ((0, import_fs35.existsSync)(settingsPath)) {
|
|
64236
64461
|
try {
|
|
64237
|
-
const settingsContent = (0,
|
|
64462
|
+
const settingsContent = (0, import_fs35.readFileSync)(settingsPath, "utf-8");
|
|
64238
64463
|
let claudeSettings;
|
|
64239
64464
|
try {
|
|
64240
64465
|
claudeSettings = JSON.parse(settingsContent);
|
|
@@ -64250,24 +64475,24 @@ function constructConfigFromClaudeDir(claudeDir) {
|
|
|
64250
64475
|
console.warn("Failed to read .claude/settings.json:", error3);
|
|
64251
64476
|
}
|
|
64252
64477
|
}
|
|
64253
|
-
const claudeMdPath = (0,
|
|
64254
|
-
if ((0,
|
|
64478
|
+
const claudeMdPath = (0, import_path35.join)(claudeDir, "..", "CLAUDE.md");
|
|
64479
|
+
if ((0, import_fs35.existsSync)(claudeMdPath)) {
|
|
64255
64480
|
try {
|
|
64256
|
-
const claudeMdContent = (0,
|
|
64481
|
+
const claudeMdContent = (0, import_fs35.readFileSync)(claudeMdPath, "utf-8");
|
|
64257
64482
|
config2.instructions = { content: claudeMdContent };
|
|
64258
64483
|
} catch (error3) {
|
|
64259
64484
|
console.warn("Failed to read CLAUDE.md:", error3);
|
|
64260
64485
|
}
|
|
64261
64486
|
}
|
|
64262
|
-
const commandsDir = (0,
|
|
64263
|
-
if ((0,
|
|
64487
|
+
const commandsDir = (0, import_path35.join)(claudeDir, "commands");
|
|
64488
|
+
if ((0, import_fs35.existsSync)(commandsDir)) {
|
|
64264
64489
|
config2.commands = [];
|
|
64265
64490
|
try {
|
|
64266
64491
|
const commandFiles = readDirRecursive(commandsDir, ".md");
|
|
64267
64492
|
for (const file of commandFiles) {
|
|
64268
64493
|
const relativePath = file.replace(commandsDir + "/", "");
|
|
64269
64494
|
const commandName = relativePath.replace(/\.md$/, "").replace(/\//g, ":");
|
|
64270
|
-
const content = (0,
|
|
64495
|
+
const content = (0, import_fs35.readFileSync)(file, "utf-8");
|
|
64271
64496
|
config2.commands.push({
|
|
64272
64497
|
name: commandName,
|
|
64273
64498
|
content
|
|
@@ -64277,14 +64502,14 @@ function constructConfigFromClaudeDir(claudeDir) {
|
|
|
64277
64502
|
console.warn("Failed to read .claude/commands/:", error3);
|
|
64278
64503
|
}
|
|
64279
64504
|
}
|
|
64280
|
-
const rulesDir = (0,
|
|
64281
|
-
if ((0,
|
|
64505
|
+
const rulesDir = (0, import_path35.join)(claudeDir, "rules");
|
|
64506
|
+
if ((0, import_fs35.existsSync)(rulesDir)) {
|
|
64282
64507
|
config2.rules = [];
|
|
64283
64508
|
try {
|
|
64284
|
-
const ruleFiles = (0,
|
|
64509
|
+
const ruleFiles = (0, import_fs35.readdirSync)(rulesDir).filter((f) => f.endsWith(".md"));
|
|
64285
64510
|
for (const file of ruleFiles) {
|
|
64286
64511
|
const ruleName = file.replace(/\.md$/, "");
|
|
64287
|
-
const content = (0,
|
|
64512
|
+
const content = (0, import_fs35.readFileSync)((0, import_path35.join)(rulesDir, file), "utf-8");
|
|
64288
64513
|
config2.rules.push({
|
|
64289
64514
|
name: ruleName,
|
|
64290
64515
|
content
|
|
@@ -64294,13 +64519,13 @@ function constructConfigFromClaudeDir(claudeDir) {
|
|
|
64294
64519
|
console.warn("Failed to read .claude/rules/:", error3);
|
|
64295
64520
|
}
|
|
64296
64521
|
}
|
|
64297
|
-
const hooksDir = (0,
|
|
64298
|
-
if ((0,
|
|
64522
|
+
const hooksDir = (0, import_path35.join)(claudeDir, "hooks");
|
|
64523
|
+
if ((0, import_fs35.existsSync)(hooksDir)) {
|
|
64299
64524
|
config2.hooks = [];
|
|
64300
64525
|
try {
|
|
64301
|
-
const hookFiles = (0,
|
|
64526
|
+
const hookFiles = (0, import_fs35.readdirSync)(hooksDir).filter((f) => f.endsWith(".js") || f.endsWith(".py") || f.endsWith(".sh"));
|
|
64302
64527
|
for (const file of hookFiles) {
|
|
64303
|
-
const content = (0,
|
|
64528
|
+
const content = (0, import_fs35.readFileSync)((0, import_path35.join)(hooksDir, file), "utf-8");
|
|
64304
64529
|
config2.hooks.push({
|
|
64305
64530
|
name: file,
|
|
64306
64531
|
event: "PreToolUse",
|
|
@@ -64312,15 +64537,15 @@ function constructConfigFromClaudeDir(claudeDir) {
|
|
|
64312
64537
|
console.warn("Failed to read .claude/hooks/:", error3);
|
|
64313
64538
|
}
|
|
64314
64539
|
}
|
|
64315
|
-
const agentsDir = (0,
|
|
64316
|
-
if ((0,
|
|
64540
|
+
const agentsDir = (0, import_path35.join)(claudeDir, "agents");
|
|
64541
|
+
if ((0, import_fs35.existsSync)(agentsDir)) {
|
|
64317
64542
|
config2.agents = [];
|
|
64318
64543
|
try {
|
|
64319
64544
|
const agentFiles = readDirRecursive(agentsDir, ".md");
|
|
64320
64545
|
for (const file of agentFiles) {
|
|
64321
64546
|
const relativePath = file.replace(agentsDir + "/", "");
|
|
64322
64547
|
const agentName = relativePath.replace(/\.md$/, "").replace(/\//g, ":");
|
|
64323
|
-
const content = (0,
|
|
64548
|
+
const content = (0, import_fs35.readFileSync)(file, "utf-8");
|
|
64324
64549
|
config2.agents.push({
|
|
64325
64550
|
name: agentName,
|
|
64326
64551
|
content
|
|
@@ -64339,10 +64564,10 @@ function constructConfigFromClaudeDir(claudeDir) {
|
|
|
64339
64564
|
function readDirRecursive(dir, extension) {
|
|
64340
64565
|
const results = [];
|
|
64341
64566
|
try {
|
|
64342
|
-
const files = (0,
|
|
64567
|
+
const files = (0, import_fs35.readdirSync)(dir);
|
|
64343
64568
|
for (const file of files) {
|
|
64344
|
-
const filePath = (0,
|
|
64345
|
-
const stat5 = (0,
|
|
64569
|
+
const filePath = (0, import_path35.join)(dir, file);
|
|
64570
|
+
const stat5 = (0, import_fs35.statSync)(filePath);
|
|
64346
64571
|
if (stat5.isDirectory()) {
|
|
64347
64572
|
results.push(...readDirRecursive(filePath, extension));
|
|
64348
64573
|
} else if (file.endsWith(extension)) {
|
|
@@ -64353,12 +64578,12 @@ function readDirRecursive(dir, extension) {
|
|
|
64353
64578
|
}
|
|
64354
64579
|
return results;
|
|
64355
64580
|
}
|
|
64356
|
-
var
|
|
64581
|
+
var import_fs35, import_path35, import_os24, import_yaml3;
|
|
64357
64582
|
var init_config_reader = __esm({
|
|
64358
64583
|
"src/utils/config-reader.ts"() {
|
|
64359
64584
|
"use strict";
|
|
64360
|
-
|
|
64361
|
-
|
|
64585
|
+
import_fs35 = require("fs");
|
|
64586
|
+
import_path35 = require("path");
|
|
64362
64587
|
import_os24 = require("os");
|
|
64363
64588
|
init_project_detection();
|
|
64364
64589
|
import_yaml3 = __toESM(require_dist(), 1);
|
|
@@ -64369,11 +64594,11 @@ var init_config_reader = __esm({
|
|
|
64369
64594
|
function getGitRepoInfo() {
|
|
64370
64595
|
try {
|
|
64371
64596
|
const projectRoot = findProjectRoot();
|
|
64372
|
-
const gitDir = (0,
|
|
64373
|
-
if (!(0,
|
|
64597
|
+
const gitDir = (0, import_path36.join)(projectRoot, ".git");
|
|
64598
|
+
if (!(0, import_fs36.existsSync)(gitDir)) {
|
|
64374
64599
|
return { isRepo: false };
|
|
64375
64600
|
}
|
|
64376
|
-
const remoteUrl = (0,
|
|
64601
|
+
const remoteUrl = (0, import_child_process12.execSync)("git remote get-url origin", {
|
|
64377
64602
|
cwd: projectRoot,
|
|
64378
64603
|
encoding: "utf-8"
|
|
64379
64604
|
}).trim();
|
|
@@ -64503,7 +64728,7 @@ function createProposeCommand() {
|
|
|
64503
64728
|
});
|
|
64504
64729
|
return command;
|
|
64505
64730
|
}
|
|
64506
|
-
var
|
|
64731
|
+
var import_fs36, import_path36, import_child_process12;
|
|
64507
64732
|
var init_propose = __esm({
|
|
64508
64733
|
"src/commands/propose.ts"() {
|
|
64509
64734
|
"use strict";
|
|
@@ -64514,9 +64739,9 @@ var init_propose = __esm({
|
|
|
64514
64739
|
init_CoreServiceProvider();
|
|
64515
64740
|
init_config_reader();
|
|
64516
64741
|
init_project_detection();
|
|
64517
|
-
|
|
64518
|
-
|
|
64519
|
-
|
|
64742
|
+
import_fs36 = require("fs");
|
|
64743
|
+
import_path36 = require("path");
|
|
64744
|
+
import_child_process12 = require("child_process");
|
|
64520
64745
|
}
|
|
64521
64746
|
});
|
|
64522
64747
|
|
|
@@ -65200,7 +65425,7 @@ function createAddCommand() {
|
|
|
65200
65425
|
let prompt2 = promptArg;
|
|
65201
65426
|
if (options.promptFile) {
|
|
65202
65427
|
try {
|
|
65203
|
-
prompt2 = (0,
|
|
65428
|
+
prompt2 = (0, import_fs37.readFileSync)(options.promptFile, "utf-8").trim();
|
|
65204
65429
|
} catch (err) {
|
|
65205
65430
|
console.error(source_default.red(`Error reading prompt file: ${err instanceof Error ? err.message : String(err)}`));
|
|
65206
65431
|
process.exit(1);
|
|
@@ -65447,14 +65672,14 @@ function createCancelCommand() {
|
|
|
65447
65672
|
}
|
|
65448
65673
|
});
|
|
65449
65674
|
}
|
|
65450
|
-
var
|
|
65675
|
+
var import_fs37, defaultApiUrl13, PRIORITY_LABELS, PRIORITY_COLORS, STATUS_COLORS;
|
|
65451
65676
|
var init_queue_mgmt = __esm({
|
|
65452
65677
|
"src/commands/queue-mgmt.ts"() {
|
|
65453
65678
|
"use strict";
|
|
65454
65679
|
init_esm();
|
|
65455
65680
|
init_source();
|
|
65456
65681
|
init_ora();
|
|
65457
|
-
|
|
65682
|
+
import_fs37 = require("fs");
|
|
65458
65683
|
init_constants();
|
|
65459
65684
|
init_config_manager();
|
|
65460
65685
|
init_client();
|
|
@@ -65698,11 +65923,11 @@ function createSeedCommand() {
|
|
|
65698
65923
|
}
|
|
65699
65924
|
let template = options.template;
|
|
65700
65925
|
if (options.templateFile) {
|
|
65701
|
-
if (!(0,
|
|
65926
|
+
if (!(0, import_fs38.existsSync)(options.templateFile)) {
|
|
65702
65927
|
console.error(source_default.red(`Error: Template file not found: ${options.templateFile}`));
|
|
65703
65928
|
process.exit(1);
|
|
65704
65929
|
}
|
|
65705
|
-
template = (0,
|
|
65930
|
+
template = (0, import_fs38.readFileSync)(options.templateFile, "utf-8").trim();
|
|
65706
65931
|
}
|
|
65707
65932
|
const config2 = ConfigManager.load();
|
|
65708
65933
|
const apiUrl = config2.apiUrl ?? process.env.GAL_API_URL ?? defaultApiUrl14;
|
|
@@ -65718,13 +65943,13 @@ function createSeedCommand() {
|
|
|
65718
65943
|
});
|
|
65719
65944
|
if (options.file) {
|
|
65720
65945
|
const filePath = options.file;
|
|
65721
|
-
if (!(0,
|
|
65946
|
+
if (!(0, import_fs38.existsSync)(filePath)) {
|
|
65722
65947
|
console.error(source_default.red(`Error: File not found: ${filePath}`));
|
|
65723
65948
|
process.exit(1);
|
|
65724
65949
|
}
|
|
65725
65950
|
let items = [];
|
|
65726
65951
|
try {
|
|
65727
|
-
const raw = (0,
|
|
65952
|
+
const raw = (0, import_fs38.readFileSync)(filePath, "utf-8");
|
|
65728
65953
|
const parsed = JSON.parse(raw);
|
|
65729
65954
|
if (!Array.isArray(parsed)) {
|
|
65730
65955
|
console.error(source_default.red("Error: JSON file must contain an array of work items."));
|
|
@@ -65889,14 +66114,14 @@ function createQueueCommand() {
|
|
|
65889
66114
|
cmd.addCommand(createSeedCommand());
|
|
65890
66115
|
return cmd;
|
|
65891
66116
|
}
|
|
65892
|
-
var
|
|
66117
|
+
var import_fs38, defaultApiUrl14, GH_API_BASE, DEFAULT_TEMPLATE_BY_LABEL, DEFAULT_TEMPLATE;
|
|
65893
66118
|
var init_queue_seed = __esm({
|
|
65894
66119
|
"src/commands/queue-seed.ts"() {
|
|
65895
66120
|
"use strict";
|
|
65896
66121
|
init_esm();
|
|
65897
66122
|
init_source();
|
|
65898
66123
|
init_ora();
|
|
65899
|
-
|
|
66124
|
+
import_fs38 = require("fs");
|
|
65900
66125
|
init_config_manager();
|
|
65901
66126
|
init_constants();
|
|
65902
66127
|
init_client();
|
|
@@ -66087,10 +66312,10 @@ function parseFrontmatter(content) {
|
|
|
66087
66312
|
};
|
|
66088
66313
|
}
|
|
66089
66314
|
function parseCommandFile(filePath) {
|
|
66090
|
-
const content = (0,
|
|
66315
|
+
const content = (0, import_fs39.readFileSync)(filePath, "utf-8");
|
|
66091
66316
|
const { metadata, body } = parseFrontmatter(content);
|
|
66092
|
-
const fileName = (0,
|
|
66093
|
-
const name = (0,
|
|
66317
|
+
const fileName = (0, import_path37.basename)(filePath);
|
|
66318
|
+
const name = (0, import_path37.basename)(filePath, (0, import_path37.extname)(filePath));
|
|
66094
66319
|
return {
|
|
66095
66320
|
name,
|
|
66096
66321
|
fileName,
|
|
@@ -66103,10 +66328,10 @@ function parseCommandFile(filePath) {
|
|
|
66103
66328
|
function findCommandFiles(dir, recursive = true) {
|
|
66104
66329
|
const files = [];
|
|
66105
66330
|
try {
|
|
66106
|
-
const entries = (0,
|
|
66331
|
+
const entries = (0, import_fs39.readdirSync)(dir);
|
|
66107
66332
|
for (const entry of entries) {
|
|
66108
|
-
const fullPath = (0,
|
|
66109
|
-
const stats = (0,
|
|
66333
|
+
const fullPath = (0, import_path37.join)(dir, entry);
|
|
66334
|
+
const stats = (0, import_fs39.statSync)(fullPath);
|
|
66110
66335
|
if (stats.isDirectory()) {
|
|
66111
66336
|
if (entry.startsWith(".") || entry === "node_modules" || entry === ".templates") {
|
|
66112
66337
|
continue;
|
|
@@ -66181,12 +66406,12 @@ function substituteArguments(commandBody, args2) {
|
|
|
66181
66406
|
}
|
|
66182
66407
|
return result;
|
|
66183
66408
|
}
|
|
66184
|
-
var
|
|
66409
|
+
var import_fs39, import_path37;
|
|
66185
66410
|
var init_command_parser = __esm({
|
|
66186
66411
|
"src/parser/command-parser.ts"() {
|
|
66187
66412
|
"use strict";
|
|
66188
|
-
|
|
66189
|
-
|
|
66413
|
+
import_fs39 = require("fs");
|
|
66414
|
+
import_path37 = require("path");
|
|
66190
66415
|
}
|
|
66191
66416
|
});
|
|
66192
66417
|
|
|
@@ -66427,12 +66652,12 @@ var init_headless_executor = __esm({
|
|
|
66427
66652
|
|
|
66428
66653
|
// src/commands/run.ts
|
|
66429
66654
|
function findCommandsDirectory() {
|
|
66430
|
-
const localCommandsDir = (0,
|
|
66431
|
-
if ((0,
|
|
66655
|
+
const localCommandsDir = (0, import_path38.join)(process.cwd(), ".claude", "commands");
|
|
66656
|
+
if ((0, import_fs40.existsSync)(localCommandsDir)) {
|
|
66432
66657
|
return localCommandsDir;
|
|
66433
66658
|
}
|
|
66434
|
-
const homeCommandsDir = (0,
|
|
66435
|
-
if ((0,
|
|
66659
|
+
const homeCommandsDir = (0, import_path38.join)((0, import_os25.homedir)(), ".claude", "commands");
|
|
66660
|
+
if ((0, import_fs40.existsSync)(homeCommandsDir)) {
|
|
66436
66661
|
return homeCommandsDir;
|
|
66437
66662
|
}
|
|
66438
66663
|
return null;
|
|
@@ -66520,7 +66745,7 @@ async function handleRunCommand(commandName, args2, options) {
|
|
|
66520
66745
|
let commandsDir = options.dir || findCommandsDirectory();
|
|
66521
66746
|
let command;
|
|
66522
66747
|
if (options.file) {
|
|
66523
|
-
if (!(0,
|
|
66748
|
+
if (!(0, import_fs40.existsSync)(options.file)) {
|
|
66524
66749
|
console.error(source_default.red(`Error: Command file not found: ${options.file}`));
|
|
66525
66750
|
process.exit(1);
|
|
66526
66751
|
}
|
|
@@ -66602,7 +66827,7 @@ Executing command: ${command.name}`));
|
|
|
66602
66827
|
throw error3;
|
|
66603
66828
|
}
|
|
66604
66829
|
}
|
|
66605
|
-
var import_os25,
|
|
66830
|
+
var import_os25, import_path38, import_fs40;
|
|
66606
66831
|
var init_run = __esm({
|
|
66607
66832
|
"src/commands/run.ts"() {
|
|
66608
66833
|
"use strict";
|
|
@@ -66610,8 +66835,8 @@ var init_run = __esm({
|
|
|
66610
66835
|
init_source();
|
|
66611
66836
|
init_ora();
|
|
66612
66837
|
import_os25 = require("os");
|
|
66613
|
-
|
|
66614
|
-
|
|
66838
|
+
import_path38 = require("path");
|
|
66839
|
+
import_fs40 = require("fs");
|
|
66615
66840
|
init_command_parser();
|
|
66616
66841
|
init_headless_executor();
|
|
66617
66842
|
}
|
|
@@ -66619,30 +66844,30 @@ var init_run = __esm({
|
|
|
66619
66844
|
|
|
66620
66845
|
// src/commands/run-design.ts
|
|
66621
66846
|
function ensureDir() {
|
|
66622
|
-
if (!(0,
|
|
66623
|
-
(0,
|
|
66847
|
+
if (!(0, import_fs41.existsSync)(DESIGN_PROJECTS_DIR)) {
|
|
66848
|
+
(0, import_fs41.mkdirSync)(DESIGN_PROJECTS_DIR, { recursive: true });
|
|
66624
66849
|
}
|
|
66625
66850
|
}
|
|
66626
66851
|
function projectPath(id) {
|
|
66627
|
-
return (0,
|
|
66852
|
+
return (0, import_path39.join)(DESIGN_PROJECTS_DIR, `${id}.json`);
|
|
66628
66853
|
}
|
|
66629
66854
|
function saveProject(project) {
|
|
66630
66855
|
ensureDir();
|
|
66631
|
-
(0,
|
|
66856
|
+
(0, import_fs41.writeFileSync)(projectPath(project.id), JSON.stringify(project, null, 2));
|
|
66632
66857
|
}
|
|
66633
66858
|
function loadProject(id) {
|
|
66634
66859
|
const p = projectPath(id);
|
|
66635
|
-
if (!(0,
|
|
66860
|
+
if (!(0, import_fs41.existsSync)(p)) return null;
|
|
66636
66861
|
try {
|
|
66637
|
-
return JSON.parse((0,
|
|
66862
|
+
return JSON.parse((0, import_fs41.readFileSync)(p, "utf-8"));
|
|
66638
66863
|
} catch {
|
|
66639
66864
|
return null;
|
|
66640
66865
|
}
|
|
66641
66866
|
}
|
|
66642
66867
|
function getActiveId() {
|
|
66643
|
-
if (!(0,
|
|
66868
|
+
if (!(0, import_fs41.existsSync)(ACTIVE_FILE)) return null;
|
|
66644
66869
|
try {
|
|
66645
|
-
const data = JSON.parse((0,
|
|
66870
|
+
const data = JSON.parse((0, import_fs41.readFileSync)(ACTIVE_FILE, "utf-8"));
|
|
66646
66871
|
return data.id ?? null;
|
|
66647
66872
|
} catch {
|
|
66648
66873
|
return null;
|
|
@@ -66650,7 +66875,7 @@ function getActiveId() {
|
|
|
66650
66875
|
}
|
|
66651
66876
|
function setActiveId(id) {
|
|
66652
66877
|
ensureDir();
|
|
66653
|
-
(0,
|
|
66878
|
+
(0, import_fs41.writeFileSync)(ACTIVE_FILE, JSON.stringify({ id }, null, 2));
|
|
66654
66879
|
}
|
|
66655
66880
|
function getActiveProject() {
|
|
66656
66881
|
const id = getActiveId();
|
|
@@ -66771,7 +66996,7 @@ function handleStatus(options) {
|
|
|
66771
66996
|
project = getActiveProject();
|
|
66772
66997
|
if (!project) {
|
|
66773
66998
|
ensureDir();
|
|
66774
|
-
const files = (0,
|
|
66999
|
+
const files = (0, import_fs41.readdirSync)(DESIGN_PROJECTS_DIR).filter(
|
|
66775
67000
|
(f) => f.endsWith(".json") && f !== "active.json"
|
|
66776
67001
|
);
|
|
66777
67002
|
if (files.length === 0) {
|
|
@@ -66886,8 +67111,8 @@ function handleSync() {
|
|
|
66886
67111
|
const project = getActiveProject();
|
|
66887
67112
|
if (!project) {
|
|
66888
67113
|
ensureDir();
|
|
66889
|
-
(0,
|
|
66890
|
-
(0,
|
|
67114
|
+
(0, import_fs41.writeFileSync)(
|
|
67115
|
+
(0, import_path39.join)(DESIGN_PROJECTS_DIR, "extension-sync.json"),
|
|
66891
67116
|
JSON.stringify(null, null, 2)
|
|
66892
67117
|
);
|
|
66893
67118
|
console.log(source_default.yellow("No active project. Extension card cleared."));
|
|
@@ -66904,8 +67129,8 @@ function handleSync() {
|
|
|
66904
67129
|
completedScenes: done
|
|
66905
67130
|
};
|
|
66906
67131
|
ensureDir();
|
|
66907
|
-
(0,
|
|
66908
|
-
(0,
|
|
67132
|
+
(0, import_fs41.writeFileSync)(
|
|
67133
|
+
(0, import_path39.join)(DESIGN_PROJECTS_DIR, "extension-sync.json"),
|
|
66909
67134
|
JSON.stringify(summary, null, 2)
|
|
66910
67135
|
);
|
|
66911
67136
|
console.log(source_default.green("\nSynced active project to extension:\n"));
|
|
@@ -66949,17 +67174,17 @@ function createRunDesignCommand() {
|
|
|
66949
67174
|
runDesign.addCommand(syncCmd);
|
|
66950
67175
|
return runDesign;
|
|
66951
67176
|
}
|
|
66952
|
-
var import_os26,
|
|
67177
|
+
var import_os26, import_path39, import_fs41, DESIGN_PROJECTS_DIR, ACTIVE_FILE, IMAGE_STATUS_ICON, VIDEO_STATUS_ICON;
|
|
66953
67178
|
var init_run_design = __esm({
|
|
66954
67179
|
"src/commands/run-design.ts"() {
|
|
66955
67180
|
"use strict";
|
|
66956
67181
|
init_esm();
|
|
66957
67182
|
init_source();
|
|
66958
67183
|
import_os26 = require("os");
|
|
66959
|
-
|
|
66960
|
-
|
|
66961
|
-
DESIGN_PROJECTS_DIR = (0,
|
|
66962
|
-
ACTIVE_FILE = (0,
|
|
67184
|
+
import_path39 = require("path");
|
|
67185
|
+
import_fs41 = require("fs");
|
|
67186
|
+
DESIGN_PROJECTS_DIR = (0, import_path39.join)((0, import_os26.homedir)(), ".gal", "design-projects");
|
|
67187
|
+
ACTIVE_FILE = (0, import_path39.join)(DESIGN_PROJECTS_DIR, "active.json");
|
|
66963
67188
|
IMAGE_STATUS_ICON = {
|
|
66964
67189
|
pending: " ",
|
|
66965
67190
|
generating: " ",
|
|
@@ -66980,104 +67205,104 @@ var init_run_design = __esm({
|
|
|
66980
67205
|
function scanPlatform(rootDir, pattern) {
|
|
66981
67206
|
const configs = [];
|
|
66982
67207
|
const platform5 = pattern.platform;
|
|
66983
|
-
const platformDir = (0,
|
|
67208
|
+
const platformDir = (0, import_path40.join)(rootDir, pattern.directory);
|
|
66984
67209
|
if (pattern.settingsFile) {
|
|
66985
|
-
const settingsPath = (0,
|
|
66986
|
-
if ((0,
|
|
67210
|
+
const settingsPath = (0, import_path40.join)(platformDir, pattern.settingsFile);
|
|
67211
|
+
if ((0, import_fs42.existsSync)(settingsPath)) {
|
|
66987
67212
|
configs.push({
|
|
66988
67213
|
platform: platform5,
|
|
66989
67214
|
type: "settings",
|
|
66990
67215
|
name: pattern.settingsFile,
|
|
66991
67216
|
path: settingsPath,
|
|
66992
|
-
relativePath: (0,
|
|
66993
|
-
sizeBytes: (0,
|
|
67217
|
+
relativePath: (0, import_path40.relative)(rootDir, settingsPath),
|
|
67218
|
+
sizeBytes: (0, import_fs42.statSync)(settingsPath).size
|
|
66994
67219
|
});
|
|
66995
67220
|
}
|
|
66996
67221
|
}
|
|
66997
67222
|
if (pattern.configFile) {
|
|
66998
|
-
const configPath = (0,
|
|
66999
|
-
if ((0,
|
|
67223
|
+
const configPath = (0, import_path40.join)(platformDir, pattern.configFile);
|
|
67224
|
+
if ((0, import_fs42.existsSync)(configPath)) {
|
|
67000
67225
|
configs.push({
|
|
67001
67226
|
platform: platform5,
|
|
67002
67227
|
type: "settings",
|
|
67003
67228
|
name: pattern.configFile,
|
|
67004
67229
|
path: configPath,
|
|
67005
|
-
relativePath: (0,
|
|
67006
|
-
sizeBytes: (0,
|
|
67230
|
+
relativePath: (0, import_path40.relative)(rootDir, configPath),
|
|
67231
|
+
sizeBytes: (0, import_fs42.statSync)(configPath).size
|
|
67007
67232
|
});
|
|
67008
67233
|
}
|
|
67009
67234
|
}
|
|
67010
67235
|
if (pattern.rulesDir) {
|
|
67011
|
-
const rulesDir = (0,
|
|
67012
|
-
if ((0,
|
|
67236
|
+
const rulesDir = (0, import_path40.join)(platformDir, pattern.rulesDir);
|
|
67237
|
+
if ((0, import_fs42.existsSync)(rulesDir) && (0, import_fs42.statSync)(rulesDir).isDirectory()) {
|
|
67013
67238
|
scanDir(rulesDir, rootDir, platform5, "rules", pattern.ruleExtensions, configs);
|
|
67014
67239
|
}
|
|
67015
67240
|
}
|
|
67016
67241
|
if (pattern.rulesFile) {
|
|
67017
|
-
const rulesPath = (0,
|
|
67018
|
-
if ((0,
|
|
67242
|
+
const rulesPath = (0, import_path40.join)(platformDir, pattern.rulesFile);
|
|
67243
|
+
if ((0, import_fs42.existsSync)(rulesPath)) {
|
|
67019
67244
|
configs.push({
|
|
67020
67245
|
platform: platform5,
|
|
67021
67246
|
type: "rules",
|
|
67022
67247
|
name: pattern.rulesFile,
|
|
67023
67248
|
path: rulesPath,
|
|
67024
|
-
relativePath: (0,
|
|
67025
|
-
sizeBytes: (0,
|
|
67249
|
+
relativePath: (0, import_path40.relative)(rootDir, rulesPath),
|
|
67250
|
+
sizeBytes: (0, import_fs42.statSync)(rulesPath).size
|
|
67026
67251
|
});
|
|
67027
67252
|
}
|
|
67028
67253
|
}
|
|
67029
67254
|
if (pattern.commandsDir) {
|
|
67030
|
-
const commandsDir = (0,
|
|
67031
|
-
if ((0,
|
|
67255
|
+
const commandsDir = (0, import_path40.join)(platformDir, pattern.commandsDir);
|
|
67256
|
+
if ((0, import_fs42.existsSync)(commandsDir) && (0, import_fs42.statSync)(commandsDir).isDirectory()) {
|
|
67032
67257
|
scanDir(commandsDir, rootDir, platform5, "commands", [".md", ".toml"], configs);
|
|
67033
67258
|
}
|
|
67034
67259
|
}
|
|
67035
67260
|
if (pattern.hooksDir) {
|
|
67036
|
-
const hooksDir = (0,
|
|
67037
|
-
if ((0,
|
|
67261
|
+
const hooksDir = (0, import_path40.join)(platformDir, pattern.hooksDir);
|
|
67262
|
+
if ((0, import_fs42.existsSync)(hooksDir) && (0, import_fs42.statSync)(hooksDir).isDirectory()) {
|
|
67038
67263
|
scanDir(hooksDir, rootDir, platform5, "hooks", [".md", ".json", ".sh", ".ts", ".js"], configs);
|
|
67039
67264
|
}
|
|
67040
67265
|
}
|
|
67041
67266
|
if (pattern.hooksConfigFile) {
|
|
67042
|
-
const hooksConfigPath = (0,
|
|
67043
|
-
if ((0,
|
|
67267
|
+
const hooksConfigPath = (0, import_path40.join)(platformDir, pattern.hooksConfigFile);
|
|
67268
|
+
if ((0, import_fs42.existsSync)(hooksConfigPath)) {
|
|
67044
67269
|
configs.push({
|
|
67045
67270
|
platform: platform5,
|
|
67046
67271
|
type: "hooks",
|
|
67047
67272
|
name: pattern.hooksConfigFile,
|
|
67048
67273
|
path: hooksConfigPath,
|
|
67049
|
-
relativePath: (0,
|
|
67050
|
-
sizeBytes: (0,
|
|
67274
|
+
relativePath: (0, import_path40.relative)(rootDir, hooksConfigPath),
|
|
67275
|
+
sizeBytes: (0, import_fs42.statSync)(hooksConfigPath).size
|
|
67051
67276
|
});
|
|
67052
67277
|
}
|
|
67053
67278
|
}
|
|
67054
67279
|
if (pattern.agentsDir) {
|
|
67055
|
-
const agentsDir = (0,
|
|
67056
|
-
if ((0,
|
|
67280
|
+
const agentsDir = (0, import_path40.join)(platformDir, pattern.agentsDir);
|
|
67281
|
+
if ((0, import_fs42.existsSync)(agentsDir) && (0, import_fs42.statSync)(agentsDir).isDirectory()) {
|
|
67057
67282
|
scanDir(agentsDir, rootDir, platform5, "agents", [".md", ".toml", ".agent.md"], configs);
|
|
67058
67283
|
}
|
|
67059
67284
|
}
|
|
67060
67285
|
if (pattern.skillsDir) {
|
|
67061
|
-
const skillsDir = (0,
|
|
67062
|
-
if ((0,
|
|
67286
|
+
const skillsDir = (0, import_path40.join)(platformDir, pattern.skillsDir);
|
|
67287
|
+
if ((0, import_fs42.existsSync)(skillsDir) && (0, import_fs42.statSync)(skillsDir).isDirectory()) {
|
|
67063
67288
|
scanDir(skillsDir, rootDir, platform5, "skills", [".md"], configs);
|
|
67064
67289
|
}
|
|
67065
67290
|
}
|
|
67066
67291
|
if (pattern.policiesDir) {
|
|
67067
|
-
const policiesDir = (0,
|
|
67068
|
-
if ((0,
|
|
67292
|
+
const policiesDir = (0, import_path40.join)(platformDir, pattern.policiesDir);
|
|
67293
|
+
if ((0, import_fs42.existsSync)(policiesDir) && (0, import_fs42.statSync)(policiesDir).isDirectory()) {
|
|
67069
67294
|
scanDir(policiesDir, rootDir, platform5, "policies", [".toml", ".md"], configs);
|
|
67070
67295
|
}
|
|
67071
67296
|
}
|
|
67072
67297
|
if (pattern.workflowsDir) {
|
|
67073
|
-
const workflowsDir = (0,
|
|
67074
|
-
if ((0,
|
|
67298
|
+
const workflowsDir = (0, import_path40.join)(platformDir, pattern.workflowsDir);
|
|
67299
|
+
if ((0, import_fs42.existsSync)(workflowsDir) && (0, import_fs42.statSync)(workflowsDir).isDirectory()) {
|
|
67075
67300
|
scanDir(workflowsDir, rootDir, platform5, "workflows", [".md"], configs);
|
|
67076
67301
|
}
|
|
67077
67302
|
}
|
|
67078
67303
|
if (pattern.promptsDir) {
|
|
67079
|
-
const promptsDir = (0,
|
|
67080
|
-
if ((0,
|
|
67304
|
+
const promptsDir = (0, import_path40.join)(platformDir, pattern.promptsDir);
|
|
67305
|
+
if ((0, import_fs42.existsSync)(promptsDir) && (0, import_fs42.statSync)(promptsDir).isDirectory()) {
|
|
67081
67306
|
scanDir(promptsDir, rootDir, platform5, "prompts", [".prompt.md", ".md"], configs);
|
|
67082
67307
|
}
|
|
67083
67308
|
}
|
|
@@ -67096,59 +67321,59 @@ function scanPlatform(rootDir, pattern) {
|
|
|
67096
67321
|
for (const { key, type } of rootInstructionFiles) {
|
|
67097
67322
|
const fileName = pattern[key];
|
|
67098
67323
|
if (fileName) {
|
|
67099
|
-
const rootPath = (0,
|
|
67100
|
-
const platformPath = (0,
|
|
67101
|
-
if ((0,
|
|
67324
|
+
const rootPath = (0, import_path40.join)(rootDir, fileName);
|
|
67325
|
+
const platformPath = (0, import_path40.join)(platformDir, fileName);
|
|
67326
|
+
if ((0, import_fs42.existsSync)(rootPath)) {
|
|
67102
67327
|
configs.push({
|
|
67103
67328
|
platform: platform5,
|
|
67104
67329
|
type,
|
|
67105
67330
|
name: fileName,
|
|
67106
67331
|
path: rootPath,
|
|
67107
|
-
relativePath: (0,
|
|
67108
|
-
sizeBytes: (0,
|
|
67332
|
+
relativePath: (0, import_path40.relative)(rootDir, rootPath),
|
|
67333
|
+
sizeBytes: (0, import_fs42.statSync)(rootPath).size
|
|
67109
67334
|
});
|
|
67110
|
-
} else if ((0,
|
|
67335
|
+
} else if ((0, import_fs42.existsSync)(platformPath) && platformPath !== rootPath) {
|
|
67111
67336
|
configs.push({
|
|
67112
67337
|
platform: platform5,
|
|
67113
67338
|
type,
|
|
67114
67339
|
name: fileName,
|
|
67115
67340
|
path: platformPath,
|
|
67116
|
-
relativePath: (0,
|
|
67117
|
-
sizeBytes: (0,
|
|
67341
|
+
relativePath: (0, import_path40.relative)(rootDir, platformPath),
|
|
67342
|
+
sizeBytes: (0, import_fs42.statSync)(platformPath).size
|
|
67118
67343
|
});
|
|
67119
67344
|
}
|
|
67120
67345
|
}
|
|
67121
67346
|
}
|
|
67122
67347
|
if (pattern.mcpFile) {
|
|
67123
|
-
const mcpPath = (0,
|
|
67124
|
-
if ((0,
|
|
67348
|
+
const mcpPath = (0, import_path40.join)(rootDir, pattern.mcpFile);
|
|
67349
|
+
if ((0, import_fs42.existsSync)(mcpPath)) {
|
|
67125
67350
|
configs.push({
|
|
67126
67351
|
platform: platform5,
|
|
67127
67352
|
type: "mcp",
|
|
67128
67353
|
name: pattern.mcpFile,
|
|
67129
67354
|
path: mcpPath,
|
|
67130
|
-
relativePath: (0,
|
|
67131
|
-
sizeBytes: (0,
|
|
67355
|
+
relativePath: (0, import_path40.relative)(rootDir, mcpPath),
|
|
67356
|
+
sizeBytes: (0, import_fs42.statSync)(mcpPath).size
|
|
67132
67357
|
});
|
|
67133
67358
|
}
|
|
67134
67359
|
}
|
|
67135
67360
|
if (pattern.memoryDir) {
|
|
67136
|
-
const memDir = (0,
|
|
67137
|
-
if ((0,
|
|
67361
|
+
const memDir = (0, import_path40.join)(platformDir, pattern.memoryDir);
|
|
67362
|
+
if ((0, import_fs42.existsSync)(memDir) && (0, import_fs42.statSync)(memDir).isDirectory()) {
|
|
67138
67363
|
const exts = pattern.memoryExtensions || [".md"];
|
|
67139
67364
|
scanDir(memDir, rootDir, platform5, "memory", exts, configs);
|
|
67140
67365
|
}
|
|
67141
67366
|
}
|
|
67142
67367
|
if (pattern.cliConfigFile) {
|
|
67143
|
-
const cliPath = (0,
|
|
67144
|
-
if ((0,
|
|
67368
|
+
const cliPath = (0, import_path40.join)(platformDir, pattern.cliConfigFile);
|
|
67369
|
+
if ((0, import_fs42.existsSync)(cliPath)) {
|
|
67145
67370
|
configs.push({
|
|
67146
67371
|
platform: platform5,
|
|
67147
67372
|
type: "settings",
|
|
67148
67373
|
name: pattern.cliConfigFile,
|
|
67149
67374
|
path: cliPath,
|
|
67150
|
-
relativePath: (0,
|
|
67151
|
-
sizeBytes: (0,
|
|
67375
|
+
relativePath: (0, import_path40.relative)(rootDir, cliPath),
|
|
67376
|
+
sizeBytes: (0, import_fs42.statSync)(cliPath).size
|
|
67152
67377
|
});
|
|
67153
67378
|
}
|
|
67154
67379
|
}
|
|
@@ -67156,9 +67381,9 @@ function scanPlatform(rootDir, pattern) {
|
|
|
67156
67381
|
}
|
|
67157
67382
|
function scanDir(dir, rootDir, platform5, type, extensions, configs) {
|
|
67158
67383
|
try {
|
|
67159
|
-
const entries = (0,
|
|
67384
|
+
const entries = (0, import_fs42.readdirSync)(dir, { withFileTypes: true });
|
|
67160
67385
|
for (const entry of entries) {
|
|
67161
|
-
const fullPath = (0,
|
|
67386
|
+
const fullPath = (0, import_path40.join)(dir, entry.name);
|
|
67162
67387
|
if (entry.isDirectory()) {
|
|
67163
67388
|
scanDir(fullPath, rootDir, platform5, type, extensions, configs);
|
|
67164
67389
|
} else if (entry.isFile()) {
|
|
@@ -67169,8 +67394,8 @@ function scanDir(dir, rootDir, platform5, type, extensions, configs) {
|
|
|
67169
67394
|
type,
|
|
67170
67395
|
name: entry.name,
|
|
67171
67396
|
path: fullPath,
|
|
67172
|
-
relativePath: (0,
|
|
67173
|
-
sizeBytes: (0,
|
|
67397
|
+
relativePath: (0, import_path40.relative)(rootDir, fullPath),
|
|
67398
|
+
sizeBytes: (0, import_fs42.statSync)(fullPath).size
|
|
67174
67399
|
});
|
|
67175
67400
|
}
|
|
67176
67401
|
}
|
|
@@ -67187,7 +67412,7 @@ function createScanCommand() {
|
|
|
67187
67412
|
const command = new Command("scan");
|
|
67188
67413
|
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) => {
|
|
67189
67414
|
const targetDir = options.path ? options.path : findProjectRoot(process.cwd());
|
|
67190
|
-
if (!(0,
|
|
67415
|
+
if (!(0, import_fs42.existsSync)(targetDir)) {
|
|
67191
67416
|
console.error(source_default.red(`Directory not found: ${targetDir}`));
|
|
67192
67417
|
process.exit(1);
|
|
67193
67418
|
}
|
|
@@ -67222,8 +67447,8 @@ function createScanCommand() {
|
|
|
67222
67447
|
for (const loc of GLOBAL_MEMORY_LOCATIONS) {
|
|
67223
67448
|
if (platformFilter && loc.platform !== platformFilter) continue;
|
|
67224
67449
|
for (const relPath of loc.paths) {
|
|
67225
|
-
const globalDir = (0,
|
|
67226
|
-
if (!(0,
|
|
67450
|
+
const globalDir = (0, import_path40.join)(home, relPath);
|
|
67451
|
+
if (!(0, import_fs42.existsSync)(globalDir) || !(0, import_fs42.statSync)(globalDir).isDirectory()) continue;
|
|
67227
67452
|
const globalConfigs = [];
|
|
67228
67453
|
scanDir(globalDir, home, loc.platform, "memory", loc.extensions, globalConfigs);
|
|
67229
67454
|
if (globalConfigs.length > 0) {
|
|
@@ -67299,14 +67524,14 @@ function createScanCommand() {
|
|
|
67299
67524
|
});
|
|
67300
67525
|
return command;
|
|
67301
67526
|
}
|
|
67302
|
-
var
|
|
67527
|
+
var import_fs42, import_path40, import_os27, GLOBAL_MEMORY_LOCATIONS, PLATFORM_LABELS, PLATFORM_COLORS;
|
|
67303
67528
|
var init_scan = __esm({
|
|
67304
67529
|
"src/commands/scan.ts"() {
|
|
67305
67530
|
"use strict";
|
|
67306
67531
|
init_esm();
|
|
67307
67532
|
init_source();
|
|
67308
|
-
|
|
67309
|
-
|
|
67533
|
+
import_fs42 = require("fs");
|
|
67534
|
+
import_path40 = require("path");
|
|
67310
67535
|
import_os27 = require("os");
|
|
67311
67536
|
init_dist2();
|
|
67312
67537
|
init_project_detection();
|
|
@@ -67979,8 +68204,8 @@ function createSandboxCommand() {
|
|
|
67979
68204
|
return sandboxCmd;
|
|
67980
68205
|
}
|
|
67981
68206
|
async function validateConfigFile(sandbox, options) {
|
|
67982
|
-
const configPath =
|
|
67983
|
-
const fileName =
|
|
68207
|
+
const configPath = import_path41.default.resolve(options.config);
|
|
68208
|
+
const fileName = import_path41.default.basename(configPath);
|
|
67984
68209
|
const spinner = ora(`Loading configuration: ${fileName}`).start();
|
|
67985
68210
|
try {
|
|
67986
68211
|
const configContent = await import_promises8.default.readFile(configPath, "utf-8");
|
|
@@ -68095,7 +68320,7 @@ async function startInteractiveSession(sandbox) {
|
|
|
68095
68320
|
rl.on("close", resolve11);
|
|
68096
68321
|
});
|
|
68097
68322
|
}
|
|
68098
|
-
var import_promises8,
|
|
68323
|
+
var import_promises8, import_path41;
|
|
68099
68324
|
var init_sandbox = __esm({
|
|
68100
68325
|
"src/commands/sandbox.ts"() {
|
|
68101
68326
|
"use strict";
|
|
@@ -68104,7 +68329,7 @@ var init_sandbox = __esm({
|
|
|
68104
68329
|
init_ora();
|
|
68105
68330
|
init_e2b_sandbox();
|
|
68106
68331
|
import_promises8 = __toESM(require("fs/promises"), 1);
|
|
68107
|
-
|
|
68332
|
+
import_path41 = __toESM(require("path"), 1);
|
|
68108
68333
|
}
|
|
68109
68334
|
});
|
|
68110
68335
|
|
|
@@ -68113,7 +68338,7 @@ function isTestFile(filename) {
|
|
|
68113
68338
|
return /\.(test|spec)\.(ts|tsx|js|jsx)$/.test(filename);
|
|
68114
68339
|
}
|
|
68115
68340
|
function isImplFile(filename) {
|
|
68116
|
-
const ext = (0,
|
|
68341
|
+
const ext = (0, import_path42.extname)(filename);
|
|
68117
68342
|
if (!IMPL_EXTENSIONS.has(ext)) return false;
|
|
68118
68343
|
if (isTestFile(filename)) return false;
|
|
68119
68344
|
if (IGNORE_FILES.has(filename)) return false;
|
|
@@ -68128,16 +68353,16 @@ function scanDirectory(dir, maxDepth = 6) {
|
|
|
68128
68353
|
if (depth > maxDepth) return;
|
|
68129
68354
|
let entries;
|
|
68130
68355
|
try {
|
|
68131
|
-
entries = (0,
|
|
68356
|
+
entries = (0, import_fs43.readdirSync)(currentDir);
|
|
68132
68357
|
} catch {
|
|
68133
68358
|
return;
|
|
68134
68359
|
}
|
|
68135
68360
|
for (const entry of entries) {
|
|
68136
68361
|
if (IGNORE_DIRS.has(entry)) continue;
|
|
68137
|
-
const fullPath = (0,
|
|
68362
|
+
const fullPath = (0, import_path42.join)(currentDir, entry);
|
|
68138
68363
|
let stat5;
|
|
68139
68364
|
try {
|
|
68140
|
-
stat5 = (0,
|
|
68365
|
+
stat5 = (0, import_fs43.statSync)(fullPath);
|
|
68141
68366
|
} catch {
|
|
68142
68367
|
continue;
|
|
68143
68368
|
}
|
|
@@ -68147,7 +68372,7 @@ function scanDirectory(dir, maxDepth = 6) {
|
|
|
68147
68372
|
}
|
|
68148
68373
|
walk(fullPath, depth + 1);
|
|
68149
68374
|
} else if (stat5.isFile()) {
|
|
68150
|
-
const relPath = (0,
|
|
68375
|
+
const relPath = (0, import_path42.relative)(dir, fullPath);
|
|
68151
68376
|
if (isTestFile(entry)) {
|
|
68152
68377
|
testFiles.push(relPath);
|
|
68153
68378
|
} else if (isImplFile(entry)) {
|
|
@@ -68167,15 +68392,15 @@ function findSpecFiles(dir) {
|
|
|
68167
68392
|
if (depth > 4) return;
|
|
68168
68393
|
let entries;
|
|
68169
68394
|
try {
|
|
68170
|
-
entries = (0,
|
|
68395
|
+
entries = (0, import_fs43.readdirSync)(currentDir);
|
|
68171
68396
|
} catch {
|
|
68172
68397
|
return;
|
|
68173
68398
|
}
|
|
68174
68399
|
for (const entry of entries) {
|
|
68175
|
-
const fullPath = (0,
|
|
68400
|
+
const fullPath = (0, import_path42.join)(currentDir, entry);
|
|
68176
68401
|
let stat5;
|
|
68177
68402
|
try {
|
|
68178
|
-
stat5 = (0,
|
|
68403
|
+
stat5 = (0, import_fs43.statSync)(fullPath);
|
|
68179
68404
|
} catch {
|
|
68180
68405
|
continue;
|
|
68181
68406
|
}
|
|
@@ -68191,10 +68416,10 @@ function findSpecFiles(dir) {
|
|
|
68191
68416
|
}
|
|
68192
68417
|
function findImplFilesWithoutTests(implFiles, testFiles) {
|
|
68193
68418
|
const testBasenames = new Set(
|
|
68194
|
-
testFiles.map((f) => (0,
|
|
68419
|
+
testFiles.map((f) => (0, import_path42.basename)(f).replace(/\.(test|spec)\.(ts|tsx|js|jsx)$/, ""))
|
|
68195
68420
|
);
|
|
68196
68421
|
return implFiles.filter((f) => {
|
|
68197
|
-
const base = (0,
|
|
68422
|
+
const base = (0, import_path42.basename)(f).replace(/\.(ts|tsx|js|jsx)$/, "");
|
|
68198
68423
|
return !testBasenames.has(base);
|
|
68199
68424
|
});
|
|
68200
68425
|
}
|
|
@@ -68224,8 +68449,8 @@ function runChecks(basePath) {
|
|
|
68224
68449
|
const weight2 = 25;
|
|
68225
68450
|
maxScore += weight2;
|
|
68226
68451
|
const hasSpecs = specFiles.length > 0;
|
|
68227
|
-
const hasClaudeDir = (0,
|
|
68228
|
-
const hasSpecsDir = (0,
|
|
68452
|
+
const hasClaudeDir = (0, import_fs43.existsSync)((0, import_path42.join)(basePath, ".claude"));
|
|
68453
|
+
const hasSpecsDir = (0, import_fs43.existsSync)((0, import_path42.join)(basePath, "specs"));
|
|
68229
68454
|
let specScore = 0;
|
|
68230
68455
|
if (hasSpecs) specScore += 15;
|
|
68231
68456
|
if (hasClaudeDir) specScore += 5;
|
|
@@ -68244,8 +68469,8 @@ function runChecks(basePath) {
|
|
|
68244
68469
|
}
|
|
68245
68470
|
const weight3 = 15;
|
|
68246
68471
|
maxScore += weight3;
|
|
68247
|
-
const hasClaudeMd = (0,
|
|
68248
|
-
const hasClaudeSettings = (0,
|
|
68472
|
+
const hasClaudeMd = (0, import_fs43.existsSync)((0, import_path42.join)(basePath, "CLAUDE.md"));
|
|
68473
|
+
const hasClaudeSettings = (0, import_fs43.existsSync)((0, import_path42.join)(basePath, ".claude", "settings.json"));
|
|
68249
68474
|
let claudeScore = 0;
|
|
68250
68475
|
if (hasClaudeMd) claudeScore += 10;
|
|
68251
68476
|
if (hasClaudeSettings) claudeScore += 5;
|
|
@@ -68263,9 +68488,9 @@ function runChecks(basePath) {
|
|
|
68263
68488
|
}
|
|
68264
68489
|
const weight4 = 15;
|
|
68265
68490
|
maxScore += weight4;
|
|
68266
|
-
const hasPackageJson = (0,
|
|
68267
|
-
const hasReadme = (0,
|
|
68268
|
-
const hasTsConfig = (0,
|
|
68491
|
+
const hasPackageJson = (0, import_fs43.existsSync)((0, import_path42.join)(basePath, "package.json"));
|
|
68492
|
+
const hasReadme = (0, import_fs43.existsSync)((0, import_path42.join)(basePath, "README.md"));
|
|
68493
|
+
const hasTsConfig = (0, import_fs43.existsSync)((0, import_path42.join)(basePath, "tsconfig.json"));
|
|
68269
68494
|
let structureScore = 0;
|
|
68270
68495
|
if (hasPackageJson) structureScore += 5;
|
|
68271
68496
|
if (hasReadme) structureScore += 5;
|
|
@@ -68285,9 +68510,9 @@ function runChecks(basePath) {
|
|
|
68285
68510
|
});
|
|
68286
68511
|
const weight5 = 15;
|
|
68287
68512
|
maxScore += weight5;
|
|
68288
|
-
const hasGitDir = (0,
|
|
68289
|
-
const hasGithubDir = (0,
|
|
68290
|
-
const hasWorkflows = (0,
|
|
68513
|
+
const hasGitDir = (0, import_fs43.existsSync)((0, import_path42.join)(basePath, ".git"));
|
|
68514
|
+
const hasGithubDir = (0, import_fs43.existsSync)((0, import_path42.join)(basePath, ".github"));
|
|
68515
|
+
const hasWorkflows = (0, import_fs43.existsSync)((0, import_path42.join)(basePath, ".github", "workflows"));
|
|
68291
68516
|
let gitScore = 0;
|
|
68292
68517
|
if (hasGitDir) gitScore += 5;
|
|
68293
68518
|
if (hasGithubDir) gitScore += 5;
|
|
@@ -68420,7 +68645,7 @@ function createSdlcCommand() {
|
|
|
68420
68645
|
}
|
|
68421
68646
|
let branchName;
|
|
68422
68647
|
try {
|
|
68423
|
-
branchName = (0,
|
|
68648
|
+
branchName = (0, import_child_process13.execSync)("git branch --show-current", { encoding: "utf-8" }).trim();
|
|
68424
68649
|
} catch {
|
|
68425
68650
|
console.error(source_default.red("\n Not inside a git repository.\n"));
|
|
68426
68651
|
process.exit(1);
|
|
@@ -68523,7 +68748,7 @@ function createSdlcCommand() {
|
|
|
68523
68748
|
}
|
|
68524
68749
|
let branchName;
|
|
68525
68750
|
try {
|
|
68526
|
-
branchName = (0,
|
|
68751
|
+
branchName = (0, import_child_process13.execSync)("git branch --show-current", { encoding: "utf-8" }).trim();
|
|
68527
68752
|
} catch {
|
|
68528
68753
|
console.error(source_default.red("\n Not inside a git repository.\n"));
|
|
68529
68754
|
process.exit(1);
|
|
@@ -68614,7 +68839,7 @@ function createSdlcCommand() {
|
|
|
68614
68839
|
try {
|
|
68615
68840
|
let branchName;
|
|
68616
68841
|
try {
|
|
68617
|
-
branchName = (0,
|
|
68842
|
+
branchName = (0, import_child_process13.execSync)("git branch --show-current", { encoding: "utf-8" }).trim();
|
|
68618
68843
|
} catch {
|
|
68619
68844
|
console.error(source_default.red("\n Not inside a git repository.\n"));
|
|
68620
68845
|
process.exit(1);
|
|
@@ -68626,8 +68851,8 @@ function createSdlcCommand() {
|
|
|
68626
68851
|
spinner.start("Scanning git history and local artifacts...");
|
|
68627
68852
|
const basePath = process.cwd();
|
|
68628
68853
|
const SDLC_PHASES_ORDERED = ["specify", "design", "test", "implement", "deploy-verify", "review", "merge"];
|
|
68629
|
-
const hasSpec = (0,
|
|
68630
|
-
const hasPlan = (0,
|
|
68854
|
+
const hasSpec = (0, import_fs43.existsSync)((0, import_path42.join)(basePath, "spec.md")) || (0, import_fs43.existsSync)((0, import_path42.join)(basePath, "specs")) || (0, import_fs43.existsSync)((0, import_path42.join)(basePath, ".claude", "spec.md"));
|
|
68855
|
+
const hasPlan = (0, import_fs43.existsSync)((0, import_path42.join)(basePath, "plan.md")) || (0, import_fs43.existsSync)((0, import_path42.join)(basePath, ".claude", "plan.md")) || (0, import_fs43.existsSync)((0, import_path42.join)(basePath, "tasks.md"));
|
|
68631
68856
|
const scanResult = scanDirectory(basePath);
|
|
68632
68857
|
const hasTests = scanResult.testFiles.length > 0;
|
|
68633
68858
|
const hasImpl = scanResult.implFiles.length > 0;
|
|
@@ -68638,7 +68863,7 @@ function createSdlcCommand() {
|
|
|
68638
68863
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
68639
68864
|
let firstCommitDate = now;
|
|
68640
68865
|
try {
|
|
68641
|
-
firstCommitDate = (0,
|
|
68866
|
+
firstCommitDate = (0, import_child_process13.execSync)(
|
|
68642
68867
|
`git log --reverse --format=%aI origin/main..HEAD 2>/dev/null | head -1`,
|
|
68643
68868
|
{ encoding: "utf-8" }
|
|
68644
68869
|
).trim() || now;
|
|
@@ -68770,16 +68995,16 @@ function createSdlcCommand() {
|
|
|
68770
68995
|
});
|
|
68771
68996
|
return cmd;
|
|
68772
68997
|
}
|
|
68773
|
-
var
|
|
68998
|
+
var import_fs43, import_path42, import_child_process13, IMPL_EXTENSIONS, IGNORE_DIRS, IGNORE_FILES;
|
|
68774
68999
|
var init_sdlc = __esm({
|
|
68775
69000
|
"src/commands/sdlc.ts"() {
|
|
68776
69001
|
"use strict";
|
|
68777
69002
|
init_esm();
|
|
68778
69003
|
init_source();
|
|
68779
69004
|
init_ora();
|
|
68780
|
-
|
|
68781
|
-
|
|
68782
|
-
|
|
69005
|
+
import_fs43 = require("fs");
|
|
69006
|
+
import_path42 = require("path");
|
|
69007
|
+
import_child_process13 = require("child_process");
|
|
68783
69008
|
init_config_manager();
|
|
68784
69009
|
IMPL_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".jsx"]);
|
|
68785
69010
|
IGNORE_DIRS = /* @__PURE__ */ new Set([
|
|
@@ -68897,10 +69122,10 @@ var init_security = __esm({
|
|
|
68897
69122
|
|
|
68898
69123
|
// src/commands/status.ts
|
|
68899
69124
|
function readTermsAcceptance() {
|
|
68900
|
-
const configFile = (0,
|
|
69125
|
+
const configFile = (0, import_path43.join)((0, import_os28.homedir)(), ".gal", "config.json");
|
|
68901
69126
|
try {
|
|
68902
|
-
if ((0,
|
|
68903
|
-
const raw = JSON.parse((0,
|
|
69127
|
+
if ((0, import_fs44.existsSync)(configFile)) {
|
|
69128
|
+
const raw = JSON.parse((0, import_fs44.readFileSync)(configFile, "utf-8"));
|
|
68904
69129
|
if (typeof raw.termsAcceptedAt === "string" && raw.termsAcceptedAt.length > 0) {
|
|
68905
69130
|
return { accepted: true, acceptedAt: raw.termsAcceptedAt };
|
|
68906
69131
|
}
|
|
@@ -69103,7 +69328,7 @@ function displayStatusJson(result, health) {
|
|
|
69103
69328
|
}
|
|
69104
69329
|
function isRateLimited(projectId) {
|
|
69105
69330
|
try {
|
|
69106
|
-
const raw = (0,
|
|
69331
|
+
const raw = (0, import_fs44.readFileSync)(DRIFT_REPORT_CACHE_PATH, "utf-8");
|
|
69107
69332
|
const cache = JSON.parse(raw);
|
|
69108
69333
|
const lastReport = cache[projectId];
|
|
69109
69334
|
if (lastReport && Date.now() - lastReport < RATE_LIMIT_MS) {
|
|
@@ -69117,13 +69342,13 @@ function recordReport(projectId) {
|
|
|
69117
69342
|
try {
|
|
69118
69343
|
let cache = {};
|
|
69119
69344
|
try {
|
|
69120
|
-
const raw = (0,
|
|
69345
|
+
const raw = (0, import_fs44.readFileSync)(DRIFT_REPORT_CACHE_PATH, "utf-8");
|
|
69121
69346
|
cache = JSON.parse(raw);
|
|
69122
69347
|
} catch {
|
|
69123
69348
|
}
|
|
69124
69349
|
cache[projectId] = Date.now();
|
|
69125
|
-
(0,
|
|
69126
|
-
(0,
|
|
69350
|
+
(0, import_fs44.mkdirSync)((0, import_path43.join)((0, import_os28.homedir)(), ".gal"), { recursive: true });
|
|
69351
|
+
(0, import_fs44.writeFileSync)(DRIFT_REPORT_CACHE_PATH, JSON.stringify(cache));
|
|
69127
69352
|
} catch {
|
|
69128
69353
|
}
|
|
69129
69354
|
}
|
|
@@ -69269,16 +69494,16 @@ function createStatusCommand3() {
|
|
|
69269
69494
|
});
|
|
69270
69495
|
return command;
|
|
69271
69496
|
}
|
|
69272
|
-
var
|
|
69497
|
+
var import_path43, import_os28, import_fs44, cliVersion6, defaultApiUrl17, PLATFORM_LABELS2, RATE_LIMIT_MS, DRIFT_REPORT_CACHE_PATH;
|
|
69273
69498
|
var init_status = __esm({
|
|
69274
69499
|
"src/commands/status.ts"() {
|
|
69275
69500
|
"use strict";
|
|
69276
69501
|
init_esm();
|
|
69277
69502
|
init_source();
|
|
69278
69503
|
init_ora();
|
|
69279
|
-
|
|
69504
|
+
import_path43 = require("path");
|
|
69280
69505
|
import_os28 = require("os");
|
|
69281
|
-
|
|
69506
|
+
import_fs44 = require("fs");
|
|
69282
69507
|
init_gal_config_service();
|
|
69283
69508
|
init_config_manager();
|
|
69284
69509
|
init_CoreServiceProvider();
|
|
@@ -69295,7 +69520,7 @@ var init_status = __esm({
|
|
|
69295
69520
|
])
|
|
69296
69521
|
);
|
|
69297
69522
|
RATE_LIMIT_MS = 5 * 60 * 1e3;
|
|
69298
|
-
DRIFT_REPORT_CACHE_PATH = (0,
|
|
69523
|
+
DRIFT_REPORT_CACHE_PATH = (0, import_path43.join)((0, import_os28.homedir)(), ".gal", "drift-report-cache.json");
|
|
69299
69524
|
}
|
|
69300
69525
|
});
|
|
69301
69526
|
|
|
@@ -70623,13 +70848,13 @@ function getGitHookManager() {
|
|
|
70623
70848
|
}
|
|
70624
70849
|
return defaultManager;
|
|
70625
70850
|
}
|
|
70626
|
-
var
|
|
70851
|
+
var import_child_process14, import_fs45, import_path44, DEFAULT_GIT_HOOK_CONFIG, GitHookManager, defaultManager;
|
|
70627
70852
|
var init_git_hooks = __esm({
|
|
70628
70853
|
"src/triggers/git-hooks.ts"() {
|
|
70629
70854
|
"use strict";
|
|
70630
|
-
|
|
70631
|
-
|
|
70632
|
-
|
|
70855
|
+
import_child_process14 = require("child_process");
|
|
70856
|
+
import_fs45 = require("fs");
|
|
70857
|
+
import_path44 = require("path");
|
|
70633
70858
|
init_source();
|
|
70634
70859
|
init_triggers();
|
|
70635
70860
|
DEFAULT_GIT_HOOK_CONFIG = {
|
|
@@ -70672,12 +70897,12 @@ var init_git_hooks = __esm({
|
|
|
70672
70897
|
if (this.gitDir) return this.gitDir;
|
|
70673
70898
|
let currentPath = startPath;
|
|
70674
70899
|
while (currentPath !== "/") {
|
|
70675
|
-
const gitPath = (0,
|
|
70676
|
-
if ((0,
|
|
70900
|
+
const gitPath = (0, import_path44.join)(currentPath, ".git");
|
|
70901
|
+
if ((0, import_fs45.existsSync)(gitPath)) {
|
|
70677
70902
|
this.gitDir = gitPath;
|
|
70678
70903
|
return gitPath;
|
|
70679
70904
|
}
|
|
70680
|
-
currentPath = (0,
|
|
70905
|
+
currentPath = (0, import_path44.dirname)(currentPath);
|
|
70681
70906
|
}
|
|
70682
70907
|
return null;
|
|
70683
70908
|
}
|
|
@@ -70699,29 +70924,29 @@ var init_git_hooks = __esm({
|
|
|
70699
70924
|
]
|
|
70700
70925
|
};
|
|
70701
70926
|
}
|
|
70702
|
-
const hooksDir = (0,
|
|
70703
|
-
if (!(0,
|
|
70704
|
-
(0,
|
|
70927
|
+
const hooksDir = (0, import_path44.join)(gitDir, "hooks");
|
|
70928
|
+
if (!(0, import_fs45.existsSync)(hooksDir)) {
|
|
70929
|
+
(0, import_fs45.mkdirSync)(hooksDir, { recursive: true });
|
|
70705
70930
|
}
|
|
70706
70931
|
const installed = [];
|
|
70707
70932
|
const skipped = [];
|
|
70708
70933
|
const warnings = [];
|
|
70709
70934
|
for (const hookType of this.config.hooks) {
|
|
70710
|
-
const hookPath = (0,
|
|
70935
|
+
const hookPath = (0, import_path44.join)(hooksDir, hookType);
|
|
70711
70936
|
const hookScript = this.generateHookScript(hookType);
|
|
70712
|
-
if ((0,
|
|
70713
|
-
const existing = (0,
|
|
70937
|
+
if ((0, import_fs45.existsSync)(hookPath)) {
|
|
70938
|
+
const existing = (0, import_fs45.readFileSync)(hookPath, "utf-8");
|
|
70714
70939
|
if (existing.includes("GAL_HOOK_MARKER")) {
|
|
70715
|
-
(0,
|
|
70716
|
-
(0,
|
|
70940
|
+
(0, import_fs45.writeFileSync)(hookPath, hookScript);
|
|
70941
|
+
(0, import_fs45.chmodSync)(hookPath, "755");
|
|
70717
70942
|
installed.push(hookType);
|
|
70718
70943
|
} else {
|
|
70719
70944
|
console.log(source_default.yellow(`Skipping ${hookType}: existing hook found`));
|
|
70720
70945
|
skipped.push(hookType);
|
|
70721
70946
|
}
|
|
70722
70947
|
} else {
|
|
70723
|
-
(0,
|
|
70724
|
-
(0,
|
|
70948
|
+
(0, import_fs45.writeFileSync)(hookPath, hookScript);
|
|
70949
|
+
(0, import_fs45.chmodSync)(hookPath, "755");
|
|
70725
70950
|
installed.push(hookType);
|
|
70726
70951
|
}
|
|
70727
70952
|
}
|
|
@@ -70738,12 +70963,12 @@ var init_git_hooks = __esm({
|
|
|
70738
70963
|
if (!gitDir) {
|
|
70739
70964
|
return [];
|
|
70740
70965
|
}
|
|
70741
|
-
const hooksDir = (0,
|
|
70966
|
+
const hooksDir = (0, import_path44.join)(gitDir, "hooks");
|
|
70742
70967
|
const removed = [];
|
|
70743
70968
|
for (const hookType of this.config.hooks) {
|
|
70744
|
-
const hookPath = (0,
|
|
70745
|
-
if ((0,
|
|
70746
|
-
const content = (0,
|
|
70969
|
+
const hookPath = (0, import_path44.join)(hooksDir, hookType);
|
|
70970
|
+
if ((0, import_fs45.existsSync)(hookPath)) {
|
|
70971
|
+
const content = (0, import_fs45.readFileSync)(hookPath, "utf-8");
|
|
70747
70972
|
if (content.includes("GAL_HOOK_MARKER")) {
|
|
70748
70973
|
const { unlinkSync: unlinkSync9 } = require("fs");
|
|
70749
70974
|
unlinkSync9(hookPath);
|
|
@@ -70813,15 +71038,15 @@ exit 0
|
|
|
70813
71038
|
hookType
|
|
70814
71039
|
};
|
|
70815
71040
|
try {
|
|
70816
|
-
payload.branch = (0,
|
|
71041
|
+
payload.branch = (0, import_child_process14.execSync)("git rev-parse --abbrev-ref HEAD", { encoding: "utf-8" }).trim();
|
|
70817
71042
|
if (hookType === "pre-commit" && this.config.scanStagedOnly) {
|
|
70818
|
-
const stagedFiles = (0,
|
|
71043
|
+
const stagedFiles = (0, import_child_process14.execSync)("git diff --cached --name-only", { encoding: "utf-8" });
|
|
70819
71044
|
payload.files = stagedFiles.split("\n").filter((f) => f.trim());
|
|
70820
71045
|
}
|
|
70821
71046
|
if (hookType === "post-commit" || hookType === "commit-msg") {
|
|
70822
|
-
payload.commit = (0,
|
|
70823
|
-
payload.message = (0,
|
|
70824
|
-
payload.author = (0,
|
|
71047
|
+
payload.commit = (0, import_child_process14.execSync)("git rev-parse HEAD", { encoding: "utf-8" }).trim();
|
|
71048
|
+
payload.message = (0, import_child_process14.execSync)("git log -1 --pretty=%B", { encoding: "utf-8" }).trim();
|
|
71049
|
+
payload.author = (0, import_child_process14.execSync)("git log -1 --pretty=%an", { encoding: "utf-8" }).trim();
|
|
70825
71050
|
}
|
|
70826
71051
|
} catch {
|
|
70827
71052
|
}
|
|
@@ -70893,7 +71118,7 @@ exit 0
|
|
|
70893
71118
|
const findings = [];
|
|
70894
71119
|
for (const file of files) {
|
|
70895
71120
|
try {
|
|
70896
|
-
const content = (0,
|
|
71121
|
+
const content = (0, import_child_process14.execSync)(`git show :${file}`, { encoding: "utf-8" });
|
|
70897
71122
|
for (const { pattern, severity } of securityPatterns) {
|
|
70898
71123
|
if (pattern.test(content)) {
|
|
70899
71124
|
findings.push({ file, pattern: pattern.source, severity });
|
|
@@ -70966,13 +71191,13 @@ exit 0
|
|
|
70966
71191
|
if (!gitDir) {
|
|
70967
71192
|
return { installed: [], missing: this.config.hooks };
|
|
70968
71193
|
}
|
|
70969
|
-
const hooksDir = (0,
|
|
71194
|
+
const hooksDir = (0, import_path44.join)(gitDir, "hooks");
|
|
70970
71195
|
const installed = [];
|
|
70971
71196
|
const missing = [];
|
|
70972
71197
|
for (const hookType of this.config.hooks) {
|
|
70973
|
-
const hookPath = (0,
|
|
70974
|
-
if ((0,
|
|
70975
|
-
const content = (0,
|
|
71198
|
+
const hookPath = (0, import_path44.join)(hooksDir, hookType);
|
|
71199
|
+
if ((0, import_fs45.existsSync)(hookPath)) {
|
|
71200
|
+
const content = (0, import_fs45.readFileSync)(hookPath, "utf-8");
|
|
70976
71201
|
if (content.includes("GAL_HOOK_MARKER")) {
|
|
70977
71202
|
installed.push(hookType);
|
|
70978
71203
|
} else {
|
|
@@ -70996,12 +71221,12 @@ function getFileWatcher() {
|
|
|
70996
71221
|
}
|
|
70997
71222
|
return defaultWatcher;
|
|
70998
71223
|
}
|
|
70999
|
-
var
|
|
71224
|
+
var import_fs46, import_path45, DEFAULT_FILE_WATCHER_CONFIG, AGENT_CONFIG_PATTERNS, FileWatcher, defaultWatcher;
|
|
71000
71225
|
var init_file_watcher = __esm({
|
|
71001
71226
|
"src/triggers/file-watcher.ts"() {
|
|
71002
71227
|
"use strict";
|
|
71003
|
-
|
|
71004
|
-
|
|
71228
|
+
import_fs46 = require("fs");
|
|
71229
|
+
import_path45 = require("path");
|
|
71005
71230
|
init_source();
|
|
71006
71231
|
init_triggers();
|
|
71007
71232
|
DEFAULT_FILE_WATCHER_CONFIG = {
|
|
@@ -71057,13 +71282,13 @@ var init_file_watcher = __esm({
|
|
|
71057
71282
|
const watching = [];
|
|
71058
71283
|
const notFound = [];
|
|
71059
71284
|
for (const watchPath of this.config.watchPaths) {
|
|
71060
|
-
const fullPath = (0,
|
|
71061
|
-
if (!(0,
|
|
71285
|
+
const fullPath = (0, import_path45.join)(basePath, watchPath);
|
|
71286
|
+
if (!(0, import_fs46.existsSync)(fullPath)) {
|
|
71062
71287
|
notFound.push(watchPath);
|
|
71063
71288
|
continue;
|
|
71064
71289
|
}
|
|
71065
71290
|
try {
|
|
71066
|
-
const watcher = (0,
|
|
71291
|
+
const watcher = (0, import_fs46.watch)(
|
|
71067
71292
|
fullPath,
|
|
71068
71293
|
{ recursive: this.config.recursive },
|
|
71069
71294
|
(eventType, filename) => {
|
|
@@ -71110,7 +71335,7 @@ var init_file_watcher = __esm({
|
|
|
71110
71335
|
* @returns True if the file matches any ignore pattern and should be skipped
|
|
71111
71336
|
*/
|
|
71112
71337
|
shouldIgnore(filename) {
|
|
71113
|
-
const name = (0,
|
|
71338
|
+
const name = (0, import_path45.basename)(filename);
|
|
71114
71339
|
for (const pattern of this.config.ignorePatterns) {
|
|
71115
71340
|
if (pattern.startsWith("*")) {
|
|
71116
71341
|
if (name.endsWith(pattern.slice(1))) {
|
|
@@ -71136,7 +71361,7 @@ var init_file_watcher = __esm({
|
|
|
71136
71361
|
* @param filename - The name of the file that changed
|
|
71137
71362
|
*/
|
|
71138
71363
|
handleFileEvent(eventType, watchPath, filename) {
|
|
71139
|
-
const fullPath = (0,
|
|
71364
|
+
const fullPath = (0, import_path45.join)(watchPath, filename);
|
|
71140
71365
|
const debounceKey = `${eventType}:${fullPath}`;
|
|
71141
71366
|
const existingTimer = this.debounceTimers.get(debounceKey);
|
|
71142
71367
|
if (existingTimer) {
|
|
@@ -71156,13 +71381,13 @@ var init_file_watcher = __esm({
|
|
|
71156
71381
|
* @param filename - The name of the file that changed
|
|
71157
71382
|
*/
|
|
71158
71383
|
async processFileEvent(eventType, watchPath, filename) {
|
|
71159
|
-
const fullPath = (0,
|
|
71384
|
+
const fullPath = (0, import_path45.join)(watchPath, filename);
|
|
71160
71385
|
let fsEventType;
|
|
71161
71386
|
let isDirectory = false;
|
|
71162
71387
|
let size;
|
|
71163
71388
|
try {
|
|
71164
|
-
if ((0,
|
|
71165
|
-
const stats = (0,
|
|
71389
|
+
if ((0, import_fs46.existsSync)(fullPath)) {
|
|
71390
|
+
const stats = (0, import_fs46.statSync)(fullPath);
|
|
71166
71391
|
isDirectory = stats.isDirectory();
|
|
71167
71392
|
size = stats.size;
|
|
71168
71393
|
fsEventType = eventType === "rename" ? "create" : "modify";
|
|
@@ -71307,12 +71532,12 @@ var init_file_watcher = __esm({
|
|
|
71307
71532
|
this.config.watchPaths.push(path8);
|
|
71308
71533
|
return true;
|
|
71309
71534
|
}
|
|
71310
|
-
const fullPath = (0,
|
|
71311
|
-
if (!(0,
|
|
71535
|
+
const fullPath = (0, import_path45.join)(basePath, path8);
|
|
71536
|
+
if (!(0, import_fs46.existsSync)(fullPath)) {
|
|
71312
71537
|
return false;
|
|
71313
71538
|
}
|
|
71314
71539
|
try {
|
|
71315
|
-
const watcher = (0,
|
|
71540
|
+
const watcher = (0, import_fs46.watch)(
|
|
71316
71541
|
fullPath,
|
|
71317
71542
|
{ recursive: this.config.recursive },
|
|
71318
71543
|
(eventType, filename) => {
|
|
@@ -71625,9 +71850,9 @@ async function confirm(message) {
|
|
|
71625
71850
|
});
|
|
71626
71851
|
}
|
|
71627
71852
|
function isGalCreatedFile(filePath) {
|
|
71628
|
-
if (!(0,
|
|
71853
|
+
if (!(0, import_fs47.existsSync)(filePath)) return false;
|
|
71629
71854
|
try {
|
|
71630
|
-
const content = (0,
|
|
71855
|
+
const content = (0, import_fs47.readFileSync)(filePath, "utf-8");
|
|
71631
71856
|
const galMarkers = [
|
|
71632
71857
|
"GAL Config",
|
|
71633
71858
|
"GAL CLI",
|
|
@@ -71647,9 +71872,9 @@ function isGalCreatedFile(filePath) {
|
|
|
71647
71872
|
}
|
|
71648
71873
|
}
|
|
71649
71874
|
function isNpmInstalledFile(filePath) {
|
|
71650
|
-
if (!(0,
|
|
71875
|
+
if (!(0, import_fs47.existsSync)(filePath)) return false;
|
|
71651
71876
|
try {
|
|
71652
|
-
const content = (0,
|
|
71877
|
+
const content = (0, import_fs47.readFileSync)(filePath, "utf-8");
|
|
71653
71878
|
return content.includes("CURRENT_VERSION =") || content.includes("const CURRENT_VERSION");
|
|
71654
71879
|
} catch {
|
|
71655
71880
|
return false;
|
|
@@ -71666,15 +71891,15 @@ function detectFileSource(filePath) {
|
|
|
71666
71891
|
}
|
|
71667
71892
|
function detectUserLevelItems(options) {
|
|
71668
71893
|
const items = [];
|
|
71669
|
-
const claudeDir = (0,
|
|
71670
|
-
const claudeHooksDir = (0,
|
|
71671
|
-
const statusLinesDir = (0,
|
|
71894
|
+
const claudeDir = (0, import_path46.join)((0, import_os29.homedir)(), ".claude");
|
|
71895
|
+
const claudeHooksDir = (0, import_path46.join)(claudeDir, "hooks");
|
|
71896
|
+
const statusLinesDir = (0, import_path46.join)(claudeDir, "status_lines");
|
|
71672
71897
|
const includeNpm = options?.includeNpmInstalled ?? true;
|
|
71673
|
-
if ((0,
|
|
71674
|
-
const files = (0,
|
|
71898
|
+
if ((0, import_fs47.existsSync)(claudeHooksDir)) {
|
|
71899
|
+
const files = (0, import_fs47.readdirSync)(claudeHooksDir);
|
|
71675
71900
|
for (const file of files) {
|
|
71676
71901
|
if (file.startsWith("gal-")) {
|
|
71677
|
-
const filePath = (0,
|
|
71902
|
+
const filePath = (0, import_path46.join)(claudeHooksDir, file);
|
|
71678
71903
|
const source = detectFileSource(filePath);
|
|
71679
71904
|
if (!includeNpm && source === "npm") {
|
|
71680
71905
|
continue;
|
|
@@ -71689,11 +71914,11 @@ function detectUserLevelItems(options) {
|
|
|
71689
71914
|
}
|
|
71690
71915
|
}
|
|
71691
71916
|
}
|
|
71692
|
-
if ((0,
|
|
71693
|
-
const files = (0,
|
|
71917
|
+
if ((0, import_fs47.existsSync)(statusLinesDir)) {
|
|
71918
|
+
const files = (0, import_fs47.readdirSync)(statusLinesDir);
|
|
71694
71919
|
for (const file of files) {
|
|
71695
71920
|
if (file.startsWith("gal-")) {
|
|
71696
|
-
const filePath = (0,
|
|
71921
|
+
const filePath = (0, import_path46.join)(statusLinesDir, file);
|
|
71697
71922
|
const source = detectFileSource(filePath);
|
|
71698
71923
|
if (!includeNpm && source === "npm") {
|
|
71699
71924
|
continue;
|
|
@@ -71708,10 +71933,10 @@ function detectUserLevelItems(options) {
|
|
|
71708
71933
|
}
|
|
71709
71934
|
}
|
|
71710
71935
|
}
|
|
71711
|
-
const claudeSettingsPath = (0,
|
|
71712
|
-
if ((0,
|
|
71936
|
+
const claudeSettingsPath = (0, import_path46.join)(claudeDir, "settings.json");
|
|
71937
|
+
if ((0, import_fs47.existsSync)(claudeSettingsPath)) {
|
|
71713
71938
|
try {
|
|
71714
|
-
const settings = JSON.parse((0,
|
|
71939
|
+
const settings = JSON.parse((0, import_fs47.readFileSync)(claudeSettingsPath, "utf-8"));
|
|
71715
71940
|
if (settings.hooks?.SessionStart) {
|
|
71716
71941
|
const hasGalHooks = settings.hooks.SessionStart.some(
|
|
71717
71942
|
(entry) => entry.hooks?.some(
|
|
@@ -71758,14 +71983,14 @@ function detectUserLevelItems(options) {
|
|
|
71758
71983
|
} catch {
|
|
71759
71984
|
}
|
|
71760
71985
|
}
|
|
71761
|
-
const cursorDir = (0,
|
|
71762
|
-
const cursorHooksDir = (0,
|
|
71763
|
-
if ((0,
|
|
71764
|
-
const files = (0,
|
|
71986
|
+
const cursorDir = (0, import_path46.join)((0, import_os29.homedir)(), ".cursor");
|
|
71987
|
+
const cursorHooksDir = (0, import_path46.join)(cursorDir, "hooks");
|
|
71988
|
+
if ((0, import_fs47.existsSync)(cursorHooksDir)) {
|
|
71989
|
+
const files = (0, import_fs47.readdirSync)(cursorHooksDir);
|
|
71765
71990
|
for (const file of files) {
|
|
71766
71991
|
if (file.startsWith("gal-")) {
|
|
71767
71992
|
items.push({
|
|
71768
|
-
path: (0,
|
|
71993
|
+
path: (0, import_path46.join)(cursorHooksDir, file),
|
|
71769
71994
|
type: "file",
|
|
71770
71995
|
reason: "GAL hook file for Cursor IDE",
|
|
71771
71996
|
isGalOwned: true
|
|
@@ -71773,10 +71998,10 @@ function detectUserLevelItems(options) {
|
|
|
71773
71998
|
}
|
|
71774
71999
|
}
|
|
71775
72000
|
}
|
|
71776
|
-
const cursorHooksJsonPath = (0,
|
|
71777
|
-
if ((0,
|
|
72001
|
+
const cursorHooksJsonPath = (0, import_path46.join)(cursorDir, "hooks.json");
|
|
72002
|
+
if ((0, import_fs47.existsSync)(cursorHooksJsonPath)) {
|
|
71778
72003
|
try {
|
|
71779
|
-
const hooksConfig = JSON.parse((0,
|
|
72004
|
+
const hooksConfig = JSON.parse((0, import_fs47.readFileSync)(cursorHooksJsonPath, "utf-8"));
|
|
71780
72005
|
const hookTypes = ["beforeShellExecution", "beforeSubmitPrompt"];
|
|
71781
72006
|
for (const hookType of hookTypes) {
|
|
71782
72007
|
if (hooksConfig.hooks?.[hookType]) {
|
|
@@ -71802,8 +72027,8 @@ function detectUserLevelItems(options) {
|
|
|
71802
72027
|
}
|
|
71803
72028
|
function detectProjectLevelItems(directory) {
|
|
71804
72029
|
const items = [];
|
|
71805
|
-
const galDir = (0,
|
|
71806
|
-
if ((0,
|
|
72030
|
+
const galDir = (0, import_path46.join)(directory, ".gal");
|
|
72031
|
+
if ((0, import_fs47.existsSync)(galDir)) {
|
|
71807
72032
|
items.push({
|
|
71808
72033
|
path: galDir,
|
|
71809
72034
|
type: "directory",
|
|
@@ -71811,8 +72036,8 @@ function detectProjectLevelItems(directory) {
|
|
|
71811
72036
|
isGalOwned: true
|
|
71812
72037
|
});
|
|
71813
72038
|
}
|
|
71814
|
-
const galConfig = (0,
|
|
71815
|
-
if ((0,
|
|
72039
|
+
const galConfig = (0, import_path46.join)(directory, "gal.config.json");
|
|
72040
|
+
if ((0, import_fs47.existsSync)(galConfig)) {
|
|
71816
72041
|
items.push({
|
|
71817
72042
|
path: galConfig,
|
|
71818
72043
|
type: "file",
|
|
@@ -71821,11 +72046,11 @@ function detectProjectLevelItems(directory) {
|
|
|
71821
72046
|
});
|
|
71822
72047
|
}
|
|
71823
72048
|
const gitHookPaths = [
|
|
71824
|
-
(0,
|
|
71825
|
-
(0,
|
|
72049
|
+
(0, import_path46.join)(directory, ".git", "hooks", "pre-commit"),
|
|
72050
|
+
(0, import_path46.join)(directory, ".husky", "pre-commit")
|
|
71826
72051
|
];
|
|
71827
72052
|
for (const hookPath of gitHookPaths) {
|
|
71828
|
-
if ((0,
|
|
72053
|
+
if ((0, import_fs47.existsSync)(hookPath) && isGalCreatedFile(hookPath)) {
|
|
71829
72054
|
items.push({
|
|
71830
72055
|
path: hookPath,
|
|
71831
72056
|
type: "file",
|
|
@@ -71835,18 +72060,18 @@ function detectProjectLevelItems(directory) {
|
|
|
71835
72060
|
}
|
|
71836
72061
|
}
|
|
71837
72062
|
const setupFiles = [
|
|
71838
|
-
{ path: (0,
|
|
71839
|
-
{ path: (0,
|
|
71840
|
-
{ path: (0,
|
|
71841
|
-
{ path: (0,
|
|
71842
|
-
{ path: (0,
|
|
71843
|
-
{ path: (0,
|
|
71844
|
-
{ path: (0,
|
|
71845
|
-
{ path: (0,
|
|
71846
|
-
{ path: (0,
|
|
72063
|
+
{ path: (0, import_path46.join)(directory, "CLAUDE.md"), reason: "GAL-generated CLAUDE.md" },
|
|
72064
|
+
{ path: (0, import_path46.join)(directory, ".claude", "settings.json"), reason: "GAL-generated settings" },
|
|
72065
|
+
{ path: (0, import_path46.join)(directory, ".claude", "commands", "review.md"), reason: "GAL-generated command" },
|
|
72066
|
+
{ path: (0, import_path46.join)(directory, ".claude", "commands", "check.md"), reason: "GAL-generated command" },
|
|
72067
|
+
{ path: (0, import_path46.join)(directory, ".github", "workflows", "ci.yml"), reason: "GAL-generated workflow" },
|
|
72068
|
+
{ path: (0, import_path46.join)(directory, ".github", "workflows", "pr-governance.yml"), reason: "GAL-generated workflow" },
|
|
72069
|
+
{ path: (0, import_path46.join)(directory, ".gitleaks.toml"), reason: "GAL-generated security config" },
|
|
72070
|
+
{ path: (0, import_path46.join)(directory, "SECURITY.md"), reason: "GAL-generated security docs" },
|
|
72071
|
+
{ path: (0, import_path46.join)(directory, ".env.example"), reason: "GAL-generated env template" }
|
|
71847
72072
|
];
|
|
71848
72073
|
for (const { path: path8, reason } of setupFiles) {
|
|
71849
|
-
if ((0,
|
|
72074
|
+
if ((0, import_fs47.existsSync)(path8) && isGalCreatedFile(path8)) {
|
|
71850
72075
|
items.push({
|
|
71851
72076
|
path: path8,
|
|
71852
72077
|
type: "file",
|
|
@@ -71859,12 +72084,12 @@ function detectProjectLevelItems(directory) {
|
|
|
71859
72084
|
}
|
|
71860
72085
|
function removeGalStatusLineEntry(settingsPath) {
|
|
71861
72086
|
try {
|
|
71862
|
-
const settings = JSON.parse((0,
|
|
72087
|
+
const settings = JSON.parse((0, import_fs47.readFileSync)(settingsPath, "utf-8"));
|
|
71863
72088
|
if (!settings.statusLine?.command?.includes("gal-")) {
|
|
71864
72089
|
return false;
|
|
71865
72090
|
}
|
|
71866
72091
|
delete settings.statusLine;
|
|
71867
|
-
(0,
|
|
72092
|
+
(0, import_fs47.writeFileSync)(settingsPath, JSON.stringify(settings, null, 2));
|
|
71868
72093
|
return true;
|
|
71869
72094
|
} catch {
|
|
71870
72095
|
return false;
|
|
@@ -71872,7 +72097,7 @@ function removeGalStatusLineEntry(settingsPath) {
|
|
|
71872
72097
|
}
|
|
71873
72098
|
function removeGalHookEntries(settingsPath) {
|
|
71874
72099
|
try {
|
|
71875
|
-
const settings = JSON.parse((0,
|
|
72100
|
+
const settings = JSON.parse((0, import_fs47.readFileSync)(settingsPath, "utf-8"));
|
|
71876
72101
|
let modified = false;
|
|
71877
72102
|
for (const hookEvent of ["SessionStart", "UserPromptSubmit"]) {
|
|
71878
72103
|
if (!settings.hooks?.[hookEvent]) continue;
|
|
@@ -71895,7 +72120,7 @@ function removeGalHookEntries(settingsPath) {
|
|
|
71895
72120
|
delete settings.hooks;
|
|
71896
72121
|
}
|
|
71897
72122
|
if (modified) {
|
|
71898
|
-
(0,
|
|
72123
|
+
(0, import_fs47.writeFileSync)(settingsPath, JSON.stringify(settings, null, 2));
|
|
71899
72124
|
return true;
|
|
71900
72125
|
}
|
|
71901
72126
|
return false;
|
|
@@ -71905,7 +72130,7 @@ function removeGalHookEntries(settingsPath) {
|
|
|
71905
72130
|
}
|
|
71906
72131
|
function removeGalCursorHookEntries(hooksJsonPath) {
|
|
71907
72132
|
try {
|
|
71908
|
-
const hooksConfig = JSON.parse((0,
|
|
72133
|
+
const hooksConfig = JSON.parse((0, import_fs47.readFileSync)(hooksJsonPath, "utf-8"));
|
|
71909
72134
|
if (!hooksConfig.hooks) {
|
|
71910
72135
|
return false;
|
|
71911
72136
|
}
|
|
@@ -71929,7 +72154,7 @@ function removeGalCursorHookEntries(hooksJsonPath) {
|
|
|
71929
72154
|
delete hooksConfig.hooks;
|
|
71930
72155
|
}
|
|
71931
72156
|
if (modified) {
|
|
71932
|
-
(0,
|
|
72157
|
+
(0, import_fs47.writeFileSync)(hooksJsonPath, JSON.stringify(hooksConfig, null, 2));
|
|
71933
72158
|
return true;
|
|
71934
72159
|
}
|
|
71935
72160
|
return false;
|
|
@@ -71964,10 +72189,10 @@ function performUninstall(items, dryRun) {
|
|
|
71964
72189
|
result.skipped.push(`${item.path} (no GAL statusLine found)`);
|
|
71965
72190
|
}
|
|
71966
72191
|
} else if (item.type === "directory") {
|
|
71967
|
-
(0,
|
|
72192
|
+
(0, import_fs47.rmSync)(item.path, { recursive: true, force: true });
|
|
71968
72193
|
result.removed.push(item.path);
|
|
71969
72194
|
} else {
|
|
71970
|
-
(0,
|
|
72195
|
+
(0, import_fs47.unlinkSync)(item.path);
|
|
71971
72196
|
result.removed.push(item.path);
|
|
71972
72197
|
}
|
|
71973
72198
|
} catch (error3) {
|
|
@@ -72063,14 +72288,14 @@ function createUninstallCommand() {
|
|
|
72063
72288
|
});
|
|
72064
72289
|
return command;
|
|
72065
72290
|
}
|
|
72066
|
-
var
|
|
72291
|
+
var import_fs47, import_path46, import_os29, import_readline5;
|
|
72067
72292
|
var init_uninstall = __esm({
|
|
72068
72293
|
"src/commands/uninstall.ts"() {
|
|
72069
72294
|
"use strict";
|
|
72070
72295
|
init_esm();
|
|
72071
72296
|
init_source();
|
|
72072
|
-
|
|
72073
|
-
|
|
72297
|
+
import_fs47 = require("fs");
|
|
72298
|
+
import_path46 = require("path");
|
|
72074
72299
|
import_os29 = require("os");
|
|
72075
72300
|
import_readline5 = require("readline");
|
|
72076
72301
|
}
|
|
@@ -72489,27 +72714,27 @@ function compareVersions2(v1, v2) {
|
|
|
72489
72714
|
}
|
|
72490
72715
|
function acquireLock() {
|
|
72491
72716
|
try {
|
|
72492
|
-
const galDir = (0,
|
|
72493
|
-
if (!(0,
|
|
72494
|
-
(0,
|
|
72717
|
+
const galDir = (0, import_path47.join)((0, import_os30.homedir)(), ".gal");
|
|
72718
|
+
if (!(0, import_fs48.existsSync)(galDir)) {
|
|
72719
|
+
(0, import_fs48.mkdirSync)(galDir, { recursive: true });
|
|
72495
72720
|
}
|
|
72496
|
-
if ((0,
|
|
72721
|
+
if ((0, import_fs48.existsSync)(UPDATE_LOCK_FILE)) {
|
|
72497
72722
|
try {
|
|
72498
|
-
const lockContent = (0,
|
|
72723
|
+
const lockContent = (0, import_fs48.readFileSync)(UPDATE_LOCK_FILE, "utf-8");
|
|
72499
72724
|
const lockTime = parseInt(lockContent, 10);
|
|
72500
72725
|
if (Number.isNaN(lockTime) || Date.now() - lockTime > 5 * 60 * 1e3) {
|
|
72501
|
-
(0,
|
|
72726
|
+
(0, import_fs48.unlinkSync)(UPDATE_LOCK_FILE);
|
|
72502
72727
|
} else {
|
|
72503
72728
|
return false;
|
|
72504
72729
|
}
|
|
72505
72730
|
} catch {
|
|
72506
72731
|
try {
|
|
72507
|
-
(0,
|
|
72732
|
+
(0, import_fs48.unlinkSync)(UPDATE_LOCK_FILE);
|
|
72508
72733
|
} catch {
|
|
72509
72734
|
}
|
|
72510
72735
|
}
|
|
72511
72736
|
}
|
|
72512
|
-
(0,
|
|
72737
|
+
(0, import_fs48.writeFileSync)(UPDATE_LOCK_FILE, String(Date.now()), { flag: "wx" });
|
|
72513
72738
|
return true;
|
|
72514
72739
|
} catch {
|
|
72515
72740
|
return false;
|
|
@@ -72517,15 +72742,15 @@ function acquireLock() {
|
|
|
72517
72742
|
}
|
|
72518
72743
|
function releaseLock() {
|
|
72519
72744
|
try {
|
|
72520
|
-
if ((0,
|
|
72521
|
-
(0,
|
|
72745
|
+
if ((0, import_fs48.existsSync)(UPDATE_LOCK_FILE)) {
|
|
72746
|
+
(0, import_fs48.unlinkSync)(UPDATE_LOCK_FILE);
|
|
72522
72747
|
}
|
|
72523
72748
|
} catch {
|
|
72524
72749
|
}
|
|
72525
72750
|
}
|
|
72526
72751
|
async function runPostUpdateInstallUpgrade() {
|
|
72527
72752
|
await new Promise((resolve11) => {
|
|
72528
|
-
const child = (0,
|
|
72753
|
+
const child = (0, import_child_process15.spawn)("gal", ["install", "--upgrade", "--quiet"], {
|
|
72529
72754
|
stdio: "ignore",
|
|
72530
72755
|
env: {
|
|
72531
72756
|
...process.env,
|
|
@@ -72623,7 +72848,7 @@ function createUpdateCommand() {
|
|
|
72623
72848
|
console.log(source_default.dim("\nRestarting with new version...\n"));
|
|
72624
72849
|
const args2 = process.argv.slice(2).filter((a) => a !== "update" && a !== "upgrade");
|
|
72625
72850
|
if (args2.length > 0) {
|
|
72626
|
-
const child = (0,
|
|
72851
|
+
const child = (0, import_child_process15.spawn)("gal", args2, { stdio: "inherit" });
|
|
72627
72852
|
child.on("exit", (code) => process.exit(code || 0));
|
|
72628
72853
|
} else {
|
|
72629
72854
|
process.exit(0);
|
|
@@ -72656,7 +72881,7 @@ Retry manually with: ${source_default.cyan(installCommand)}`);
|
|
|
72656
72881
|
});
|
|
72657
72882
|
return command;
|
|
72658
72883
|
}
|
|
72659
|
-
var import_https,
|
|
72884
|
+
var import_https, import_child_process15, import_fs48, import_path47, import_os30, UPDATE_LOCK_FILE, cliVersion7, REGISTRY_URL;
|
|
72660
72885
|
var init_update = __esm({
|
|
72661
72886
|
"src/commands/update.ts"() {
|
|
72662
72887
|
"use strict";
|
|
@@ -72664,15 +72889,15 @@ var init_update = __esm({
|
|
|
72664
72889
|
init_source();
|
|
72665
72890
|
init_ora();
|
|
72666
72891
|
import_https = __toESM(require("https"), 1);
|
|
72667
|
-
|
|
72668
|
-
|
|
72669
|
-
|
|
72892
|
+
import_child_process15 = require("child_process");
|
|
72893
|
+
import_fs48 = require("fs");
|
|
72894
|
+
import_path47 = require("path");
|
|
72670
72895
|
import_os30 = require("os");
|
|
72671
72896
|
init_constants();
|
|
72672
72897
|
init_path_conflict();
|
|
72673
72898
|
init_install();
|
|
72674
72899
|
init_telemetry();
|
|
72675
|
-
UPDATE_LOCK_FILE = (0,
|
|
72900
|
+
UPDATE_LOCK_FILE = (0, import_path47.join)((0, import_os30.homedir)(), ".gal", "update.lock");
|
|
72676
72901
|
cliVersion7 = constants_default[0];
|
|
72677
72902
|
REGISTRY_URL = getRegistryUrl();
|
|
72678
72903
|
}
|
|
@@ -73180,9 +73405,9 @@ function createWorkflowCommand() {
|
|
|
73180
73405
|
const apiUrl = process.env.GAL_API_URL || defaultApiUrl19;
|
|
73181
73406
|
try {
|
|
73182
73407
|
const spinner = ora(`Reading ${filePath}...`).start();
|
|
73183
|
-
const absolutePath =
|
|
73408
|
+
const absolutePath = import_path48.default.resolve(filePath);
|
|
73184
73409
|
const content = await import_promises9.default.readFile(absolutePath, "utf-8");
|
|
73185
|
-
const fileName =
|
|
73410
|
+
const fileName = import_path48.default.basename(filePath);
|
|
73186
73411
|
let type = options.type;
|
|
73187
73412
|
if (!type) {
|
|
73188
73413
|
if (fileName.endsWith(".md")) {
|
|
@@ -73238,7 +73463,7 @@ function createWorkflowCommand() {
|
|
|
73238
73463
|
spinner.fail(source_default.red("No organization found. Please connect GitHub via dashboard or use --org flag"));
|
|
73239
73464
|
process.exit(1);
|
|
73240
73465
|
}
|
|
73241
|
-
const dirPath =
|
|
73466
|
+
const dirPath = import_path48.default.resolve(directory);
|
|
73242
73467
|
const files = await import_promises9.default.readdir(dirPath);
|
|
73243
73468
|
const workflowFiles = files.filter(
|
|
73244
73469
|
(f) => f.endsWith(".md") || f.includes("hook") && (f.endsWith(".json") || f.endsWith(".py") || f.endsWith(".js"))
|
|
@@ -73250,7 +73475,7 @@ function createWorkflowCommand() {
|
|
|
73250
73475
|
spinner.text = `Found ${workflowFiles.length} workflow files. Preparing batch test...`;
|
|
73251
73476
|
const requests = [];
|
|
73252
73477
|
for (const file of workflowFiles) {
|
|
73253
|
-
const filePath =
|
|
73478
|
+
const filePath = import_path48.default.join(dirPath, file);
|
|
73254
73479
|
const content = await import_promises9.default.readFile(filePath, "utf-8");
|
|
73255
73480
|
const type = file.endsWith(".md") ? "command" : "hook";
|
|
73256
73481
|
requests.push({
|
|
@@ -73348,7 +73573,7 @@ function displayTestResult(result) {
|
|
|
73348
73573
|
}
|
|
73349
73574
|
console.log();
|
|
73350
73575
|
}
|
|
73351
|
-
var import_promises9,
|
|
73576
|
+
var import_promises9, import_path48, defaultApiUrl19;
|
|
73352
73577
|
var init_workflow2 = __esm({
|
|
73353
73578
|
"src/commands/workflow.ts"() {
|
|
73354
73579
|
"use strict";
|
|
@@ -73356,7 +73581,7 @@ var init_workflow2 = __esm({
|
|
|
73356
73581
|
init_source();
|
|
73357
73582
|
init_ora();
|
|
73358
73583
|
import_promises9 = __toESM(require("fs/promises"), 1);
|
|
73359
|
-
|
|
73584
|
+
import_path48 = __toESM(require("path"), 1);
|
|
73360
73585
|
init_constants();
|
|
73361
73586
|
init_client();
|
|
73362
73587
|
defaultApiUrl19 = constants_default[1];
|
|
@@ -73690,11 +73915,11 @@ function getRegistryAuthToken2() {
|
|
|
73690
73915
|
return void 0;
|
|
73691
73916
|
}
|
|
73692
73917
|
try {
|
|
73693
|
-
const npmrcPath = (0,
|
|
73694
|
-
if (!(0,
|
|
73918
|
+
const npmrcPath = (0, import_path49.join)((0, import_os31.homedir)(), ".npmrc");
|
|
73919
|
+
if (!(0, import_fs49.existsSync)(npmrcPath)) {
|
|
73695
73920
|
return void 0;
|
|
73696
73921
|
}
|
|
73697
|
-
const npmrc = (0,
|
|
73922
|
+
const npmrc = (0, import_fs49.readFileSync)(npmrcPath, "utf-8");
|
|
73698
73923
|
const escapedHost = REGISTRY_HOST.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
73699
73924
|
const match = npmrc.match(
|
|
73700
73925
|
new RegExp(`^//${escapedHost}/:_authToken=(.+)$`, "m")
|
|
@@ -73714,8 +73939,8 @@ function getRegistryAuthToken2() {
|
|
|
73714
73939
|
}
|
|
73715
73940
|
function readUpdateCache() {
|
|
73716
73941
|
try {
|
|
73717
|
-
if ((0,
|
|
73718
|
-
return JSON.parse((0,
|
|
73942
|
+
if ((0, import_fs49.existsSync)(UPDATE_CACHE_FILE)) {
|
|
73943
|
+
return JSON.parse((0, import_fs49.readFileSync)(UPDATE_CACHE_FILE, "utf-8"));
|
|
73719
73944
|
}
|
|
73720
73945
|
} catch {
|
|
73721
73946
|
}
|
|
@@ -73723,10 +73948,10 @@ function readUpdateCache() {
|
|
|
73723
73948
|
}
|
|
73724
73949
|
function writeUpdateCache(cache) {
|
|
73725
73950
|
try {
|
|
73726
|
-
if (!(0,
|
|
73727
|
-
(0,
|
|
73951
|
+
if (!(0, import_fs49.existsSync)(UPDATE_CACHE_DIR)) {
|
|
73952
|
+
(0, import_fs49.mkdirSync)(UPDATE_CACHE_DIR, { recursive: true });
|
|
73728
73953
|
}
|
|
73729
|
-
(0,
|
|
73954
|
+
(0, import_fs49.writeFileSync)(UPDATE_CACHE_FILE, JSON.stringify(cache));
|
|
73730
73955
|
} catch {
|
|
73731
73956
|
}
|
|
73732
73957
|
}
|
|
@@ -73776,7 +74001,7 @@ async function promptUpdateInteractive(currentVersion, latestVersion) {
|
|
|
73776
74001
|
}
|
|
73777
74002
|
async function runInlineUpdate() {
|
|
73778
74003
|
return new Promise((resolve11, reject) => {
|
|
73779
|
-
const child = (0,
|
|
74004
|
+
const child = (0, import_child_process16.spawn)("gal", ["update"], {
|
|
73780
74005
|
stdio: "inherit",
|
|
73781
74006
|
env: { ...process.env, GAL_AUTO_UPDATE: "0" }
|
|
73782
74007
|
});
|
|
@@ -73835,7 +74060,7 @@ async function checkForUpdates() {
|
|
|
73835
74060
|
const args2 = process.argv.slice(2).filter((a) => a !== "update");
|
|
73836
74061
|
console.log(source_default.dim("\nRestarting with new version...\n"));
|
|
73837
74062
|
if (args2.length > 0) {
|
|
73838
|
-
const child = (0,
|
|
74063
|
+
const child = (0, import_child_process16.spawn)("gal", args2, { stdio: "inherit" });
|
|
73839
74064
|
child.on("exit", (code) => process.exit(code || 0));
|
|
73840
74065
|
} else {
|
|
73841
74066
|
process.exit(0);
|
|
@@ -73864,9 +74089,9 @@ async function checkForUpdates() {
|
|
|
73864
74089
|
});
|
|
73865
74090
|
if (!isUpdateCommand && !isCI && !isAutoUpdateDisabled) {
|
|
73866
74091
|
try {
|
|
73867
|
-
const lockFile = (0,
|
|
73868
|
-
if (!(0,
|
|
73869
|
-
const child = (0,
|
|
74092
|
+
const lockFile = (0, import_path49.join)((0, import_os31.homedir)(), ".gal", "update.lock");
|
|
74093
|
+
if (!(0, import_fs49.existsSync)(lockFile)) {
|
|
74094
|
+
const child = (0, import_child_process16.spawn)("gal", ["update"], {
|
|
73870
74095
|
detached: true,
|
|
73871
74096
|
stdio: "ignore",
|
|
73872
74097
|
env: { ...process.env, GAL_AUTO_UPDATE: "1" }
|
|
@@ -73914,9 +74139,9 @@ async function checkForUpdates() {
|
|
|
73914
74139
|
function checkPathConflicts() {
|
|
73915
74140
|
try {
|
|
73916
74141
|
if (process.env.CI === "true" || process.argv.includes("--json")) return;
|
|
73917
|
-
const CONFLICT_CACHE = (0,
|
|
73918
|
-
if ((0,
|
|
73919
|
-
const cached2 = JSON.parse((0,
|
|
74142
|
+
const CONFLICT_CACHE = (0, import_path49.join)(UPDATE_CACHE_DIR, "path-conflict-cache.json");
|
|
74143
|
+
if ((0, import_fs49.existsSync)(CONFLICT_CACHE)) {
|
|
74144
|
+
const cached2 = JSON.parse((0, import_fs49.readFileSync)(CONFLICT_CACHE, "utf-8"));
|
|
73920
74145
|
if (Date.now() - (cached2.lastCheck || 0) < ONE_DAY) {
|
|
73921
74146
|
if (cached2.hasConflict) {
|
|
73922
74147
|
process.on("exit", () => {
|
|
@@ -73930,10 +74155,10 @@ function checkPathConflicts() {
|
|
|
73930
74155
|
const conflict = detectPathConflict(cliVersion9);
|
|
73931
74156
|
const cacheData = { lastCheck: Date.now(), hasConflict: !!conflict };
|
|
73932
74157
|
try {
|
|
73933
|
-
if (!(0,
|
|
73934
|
-
(0,
|
|
74158
|
+
if (!(0, import_fs49.existsSync)(UPDATE_CACHE_DIR)) {
|
|
74159
|
+
(0, import_fs49.mkdirSync)(UPDATE_CACHE_DIR, { recursive: true });
|
|
73935
74160
|
}
|
|
73936
|
-
(0,
|
|
74161
|
+
(0, import_fs49.writeFileSync)(CONFLICT_CACHE, JSON.stringify(cacheData));
|
|
73937
74162
|
} catch {
|
|
73938
74163
|
}
|
|
73939
74164
|
if (conflict) {
|
|
@@ -73946,9 +74171,9 @@ function checkPathConflicts() {
|
|
|
73946
74171
|
}
|
|
73947
74172
|
function refreshOrgMemberships() {
|
|
73948
74173
|
try {
|
|
73949
|
-
const configPath = (0,
|
|
73950
|
-
if (!(0,
|
|
73951
|
-
const config2 = JSON.parse((0,
|
|
74174
|
+
const configPath = (0, import_path49.join)((0, import_os31.homedir)(), ".gal", "config.json");
|
|
74175
|
+
if (!(0, import_fs49.existsSync)(configPath)) return;
|
|
74176
|
+
const config2 = JSON.parse((0, import_fs49.readFileSync)(configPath, "utf-8"));
|
|
73952
74177
|
if (!config2.authToken) return;
|
|
73953
74178
|
const checkedAt = config2.orgMembershipsCheckedAt || 0;
|
|
73954
74179
|
if (Date.now() - checkedAt < ONE_DAY) return;
|
|
@@ -73980,10 +74205,10 @@ function refreshOrgMemberships() {
|
|
|
73980
74205
|
config2.capabilities = user.capabilities;
|
|
73981
74206
|
config2.capabilitiesCachedAt = Date.now();
|
|
73982
74207
|
}
|
|
73983
|
-
if (!(0,
|
|
73984
|
-
(0,
|
|
74208
|
+
if (!(0, import_fs49.existsSync)(UPDATE_CACHE_DIR)) {
|
|
74209
|
+
(0, import_fs49.mkdirSync)(UPDATE_CACHE_DIR, { recursive: true });
|
|
73985
74210
|
}
|
|
73986
|
-
(0,
|
|
74211
|
+
(0, import_fs49.writeFileSync)(configPath, JSON.stringify(config2, null, 2));
|
|
73987
74212
|
}
|
|
73988
74213
|
} catch {
|
|
73989
74214
|
}
|
|
@@ -74010,11 +74235,11 @@ function refreshOrgMemberships() {
|
|
|
74010
74235
|
if (res.statusCode !== 200) return;
|
|
74011
74236
|
const flags = JSON.parse(data);
|
|
74012
74237
|
if (flags.orgAudienceTierMap) {
|
|
74013
|
-
const freshConfig = JSON.parse((0,
|
|
74238
|
+
const freshConfig = JSON.parse((0, import_fs49.readFileSync)(configPath, "utf-8"));
|
|
74014
74239
|
freshConfig.orgAudienceTierMap = flags.orgAudienceTierMap;
|
|
74015
74240
|
freshConfig.orgPlanMap = flags.orgPlanMap || freshConfig.orgPlanMap || {};
|
|
74016
74241
|
freshConfig.flagsCachedAt = Date.now();
|
|
74017
|
-
(0,
|
|
74242
|
+
(0, import_fs49.writeFileSync)(configPath, JSON.stringify(freshConfig, null, 2));
|
|
74018
74243
|
}
|
|
74019
74244
|
} catch {
|
|
74020
74245
|
}
|
|
@@ -74033,7 +74258,7 @@ function refreshOrgMemberships() {
|
|
|
74033
74258
|
} catch {
|
|
74034
74259
|
}
|
|
74035
74260
|
}
|
|
74036
|
-
var import_dotenv, import_https2, import_readline6,
|
|
74261
|
+
var import_dotenv, import_https2, import_readline6, import_child_process16, import_fs49, import_path49, import_os31, 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;
|
|
74037
74262
|
var init_index = __esm({
|
|
74038
74263
|
"src/index.ts"() {
|
|
74039
74264
|
"use strict";
|
|
@@ -74041,9 +74266,9 @@ var init_index = __esm({
|
|
|
74041
74266
|
import_dotenv = __toESM(require_main(), 1);
|
|
74042
74267
|
import_https2 = __toESM(require("https"), 1);
|
|
74043
74268
|
import_readline6 = __toESM(require("readline"), 1);
|
|
74044
|
-
|
|
74045
|
-
|
|
74046
|
-
|
|
74269
|
+
import_child_process16 = require("child_process");
|
|
74270
|
+
import_fs49 = require("fs");
|
|
74271
|
+
import_path49 = require("path");
|
|
74047
74272
|
import_os31 = require("os");
|
|
74048
74273
|
init_source();
|
|
74049
74274
|
init_constants();
|
|
@@ -74075,8 +74300,8 @@ var init_index = __esm({
|
|
|
74075
74300
|
}, GLOBAL_TIMEOUT_MS);
|
|
74076
74301
|
globalTimeout.unref();
|
|
74077
74302
|
cliVersion9 = constants_default[0];
|
|
74078
|
-
UPDATE_CACHE_DIR = (0,
|
|
74079
|
-
UPDATE_CACHE_FILE = (0,
|
|
74303
|
+
UPDATE_CACHE_DIR = (0, import_path49.join)((0, import_os31.homedir)(), ".gal");
|
|
74304
|
+
UPDATE_CACHE_FILE = (0, import_path49.join)(UPDATE_CACHE_DIR, "update-cache.json");
|
|
74080
74305
|
ONE_DAY = 24 * 60 * 60 * 1e3;
|
|
74081
74306
|
REGISTRY_URL2 = (() => {
|
|
74082
74307
|
const raw = process.env.GAL_REGISTRY_URL || "https://registry.npmjs.org";
|
|
@@ -74224,7 +74449,7 @@ var init_index = __esm({
|
|
|
74224
74449
|
});
|
|
74225
74450
|
|
|
74226
74451
|
// src/bootstrap.ts
|
|
74227
|
-
var cliVersion10 = true ? "0.0.
|
|
74452
|
+
var cliVersion10 = true ? "0.0.471" : "0.0.0-dev";
|
|
74228
74453
|
var args = process.argv.slice(2);
|
|
74229
74454
|
var requestedGlobalHelp = args.length === 1 && (args[0] === "--help" || args[0] === "-h");
|
|
74230
74455
|
var requestedVersion = args.length === 1 && (args[0] === "--version" || args[0] === "-V");
|