@chiendt/ack-cli 1.3.0-dev.5 → 1.3.0-dev.7
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/cli-manifest.json +2 -2
- package/dist/index.js +362 -274
- package/package.json +1 -1
package/cli-manifest.json
CHANGED
package/dist/index.js
CHANGED
|
@@ -63756,7 +63756,7 @@ var package_default;
|
|
|
63756
63756
|
var init_package = __esm(() => {
|
|
63757
63757
|
package_default = {
|
|
63758
63758
|
name: "@chiendt/ack-cli",
|
|
63759
|
-
version: "1.3.0-dev.
|
|
63759
|
+
version: "1.3.0-dev.7",
|
|
63760
63760
|
description: "ACK CLI - tool for bootstrapping and updating ACK kits (Claude Code agent kits)",
|
|
63761
63761
|
type: "module",
|
|
63762
63762
|
repository: {
|
|
@@ -72527,6 +72527,247 @@ var init_github_api_checker = __esm(() => {
|
|
|
72527
72527
|
init_types3();
|
|
72528
72528
|
});
|
|
72529
72529
|
|
|
72530
|
+
// src/domains/installation/npmrc-bootstrap.ts
|
|
72531
|
+
import { promises as fs10 } from "node:fs";
|
|
72532
|
+
import { dirname as dirname29 } from "node:path";
|
|
72533
|
+
function mergeNpmrcEntries(existing, entries) {
|
|
72534
|
+
const keys = new Set(Object.keys(entries));
|
|
72535
|
+
const seenKeys = new Set;
|
|
72536
|
+
const lines = existing.split(`
|
|
72537
|
+
`);
|
|
72538
|
+
const out = [];
|
|
72539
|
+
for (const line of lines) {
|
|
72540
|
+
const stripped = line.trim();
|
|
72541
|
+
if (stripped === "" || stripped.startsWith(";") || stripped.startsWith("#")) {
|
|
72542
|
+
out.push(line);
|
|
72543
|
+
continue;
|
|
72544
|
+
}
|
|
72545
|
+
const eq = line.indexOf("=");
|
|
72546
|
+
if (eq < 0) {
|
|
72547
|
+
out.push(line);
|
|
72548
|
+
continue;
|
|
72549
|
+
}
|
|
72550
|
+
const key = line.slice(0, eq).trim();
|
|
72551
|
+
if (keys.has(key)) {
|
|
72552
|
+
seenKeys.add(key);
|
|
72553
|
+
out.push(`${key}=${entries[key]}`);
|
|
72554
|
+
} else {
|
|
72555
|
+
out.push(line);
|
|
72556
|
+
}
|
|
72557
|
+
}
|
|
72558
|
+
const additions = [];
|
|
72559
|
+
for (const key of keys) {
|
|
72560
|
+
if (!seenKeys.has(key)) {
|
|
72561
|
+
additions.push(`${key}=${entries[key]}`);
|
|
72562
|
+
}
|
|
72563
|
+
}
|
|
72564
|
+
let result = out.join(`
|
|
72565
|
+
`);
|
|
72566
|
+
if (additions.length > 0) {
|
|
72567
|
+
if (result.length > 0 && !result.endsWith(`
|
|
72568
|
+
`))
|
|
72569
|
+
result += `
|
|
72570
|
+
`;
|
|
72571
|
+
result += `${additions.join(`
|
|
72572
|
+
`)}
|
|
72573
|
+
`;
|
|
72574
|
+
} else if (result.length > 0 && !result.endsWith(`
|
|
72575
|
+
`)) {
|
|
72576
|
+
result += `
|
|
72577
|
+
`;
|
|
72578
|
+
}
|
|
72579
|
+
return result;
|
|
72580
|
+
}
|
|
72581
|
+
async function writeNpmrc(path8, entries, opts = {}) {
|
|
72582
|
+
let existing = "";
|
|
72583
|
+
let hadFile = false;
|
|
72584
|
+
try {
|
|
72585
|
+
existing = await fs10.readFile(path8, "utf8");
|
|
72586
|
+
hadFile = true;
|
|
72587
|
+
} catch (err) {
|
|
72588
|
+
if (err.code !== "ENOENT")
|
|
72589
|
+
throw err;
|
|
72590
|
+
}
|
|
72591
|
+
const merged = mergeNpmrcEntries(existing, entries);
|
|
72592
|
+
if (merged === existing) {
|
|
72593
|
+
return { written: false, backupPath: null, finalPath: path8, noChange: true };
|
|
72594
|
+
}
|
|
72595
|
+
let backupPath = null;
|
|
72596
|
+
if (hadFile) {
|
|
72597
|
+
const now = opts.now?.() ?? new Date;
|
|
72598
|
+
const stamp = now.toISOString().replace(/[:.]/g, "-");
|
|
72599
|
+
backupPath = `${path8}.bak.${stamp}`;
|
|
72600
|
+
await fs10.copyFile(path8, backupPath);
|
|
72601
|
+
}
|
|
72602
|
+
await fs10.mkdir(dirname29(path8), { recursive: true });
|
|
72603
|
+
const tmp = `${path8}.tmp.${process.pid}`;
|
|
72604
|
+
await fs10.writeFile(tmp, merged, { mode: 384 });
|
|
72605
|
+
await fs10.rename(tmp, path8);
|
|
72606
|
+
try {
|
|
72607
|
+
await fs10.chmod(path8, 384);
|
|
72608
|
+
} catch {}
|
|
72609
|
+
return { written: true, backupPath, finalPath: path8, noChange: false };
|
|
72610
|
+
}
|
|
72611
|
+
function buildGitHubPackagesEntries(pat) {
|
|
72612
|
+
const trimmed = pat.trim();
|
|
72613
|
+
return {
|
|
72614
|
+
[SCOPE_REGISTRY_KEY]: GITHUB_PACKAGES_REGISTRY_URL,
|
|
72615
|
+
[AUTH_TOKEN_KEY]: trimmed
|
|
72616
|
+
};
|
|
72617
|
+
}
|
|
72618
|
+
function isValidGitHubPat(value) {
|
|
72619
|
+
const v2 = value.trim();
|
|
72620
|
+
if (v2.length < 8)
|
|
72621
|
+
return false;
|
|
72622
|
+
if (/\s/.test(v2))
|
|
72623
|
+
return false;
|
|
72624
|
+
return /^(ghp_|github_pat_|ghs_|gho_|ghu_|ghr_)/.test(v2);
|
|
72625
|
+
}
|
|
72626
|
+
var GITHUB_PACKAGES_REGISTRY_URL = "https://npm.pkg.github.com", GITHUB_PACKAGES_SCOPE = "@chiendt1108", SCOPE_REGISTRY_KEY, AUTH_TOKEN_KEY = "//npm.pkg.github.com/:_authToken";
|
|
72627
|
+
var init_npmrc_bootstrap = __esm(() => {
|
|
72628
|
+
SCOPE_REGISTRY_KEY = `${GITHUB_PACKAGES_SCOPE}:registry`;
|
|
72629
|
+
});
|
|
72630
|
+
|
|
72631
|
+
// src/commands/fqc-qa/npmrc-setup-step.ts
|
|
72632
|
+
var exports_npmrc_setup_step = {};
|
|
72633
|
+
__export(exports_npmrc_setup_step, {
|
|
72634
|
+
runNpmrcSetupStep: () => runNpmrcSetupStep
|
|
72635
|
+
});
|
|
72636
|
+
import { execFile as execFile10 } from "node:child_process";
|
|
72637
|
+
import { existsSync as existsSync66, readFileSync as readFileSync20 } from "node:fs";
|
|
72638
|
+
import { homedir as homedir45 } from "node:os";
|
|
72639
|
+
import { join as join96 } from "node:path";
|
|
72640
|
+
import { promisify as promisify12 } from "node:util";
|
|
72641
|
+
function resolveTokenFromEnv() {
|
|
72642
|
+
const fromProcess = process.env[TOKEN_ENV_KEY];
|
|
72643
|
+
if (fromProcess && fromProcess.length > 0) {
|
|
72644
|
+
return { token: fromProcess, source: "env" };
|
|
72645
|
+
}
|
|
72646
|
+
const dotenvPath = join96(process.cwd(), ".env");
|
|
72647
|
+
if (!existsSync66(dotenvPath))
|
|
72648
|
+
return null;
|
|
72649
|
+
let contents;
|
|
72650
|
+
try {
|
|
72651
|
+
contents = readFileSync20(dotenvPath, "utf8");
|
|
72652
|
+
} catch {
|
|
72653
|
+
return null;
|
|
72654
|
+
}
|
|
72655
|
+
for (const rawLine of contents.split(`
|
|
72656
|
+
`)) {
|
|
72657
|
+
const line = rawLine.trim();
|
|
72658
|
+
if (line.length === 0 || line.startsWith("#"))
|
|
72659
|
+
continue;
|
|
72660
|
+
const eq = line.indexOf("=");
|
|
72661
|
+
if (eq < 0)
|
|
72662
|
+
continue;
|
|
72663
|
+
const key = line.slice(0, eq).trim();
|
|
72664
|
+
if (key !== TOKEN_ENV_KEY)
|
|
72665
|
+
continue;
|
|
72666
|
+
let value = line.slice(eq + 1).trim();
|
|
72667
|
+
if (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'")) {
|
|
72668
|
+
value = value.slice(1, -1);
|
|
72669
|
+
}
|
|
72670
|
+
if (value.length === 0)
|
|
72671
|
+
return null;
|
|
72672
|
+
return { token: value, source: "dotenv" };
|
|
72673
|
+
}
|
|
72674
|
+
return null;
|
|
72675
|
+
}
|
|
72676
|
+
async function smokeGitHubPackagesAuth() {
|
|
72677
|
+
try {
|
|
72678
|
+
const { stdout } = await execFileP("npm", ["view", "@chiendt1108/fqc-mcp-servers", "version"], {
|
|
72679
|
+
timeout: 15000
|
|
72680
|
+
});
|
|
72681
|
+
const version = stdout.trim();
|
|
72682
|
+
logger.info(import_picocolors19.default.green(`✓ GitHub Packages reachable — fqc-mcp-servers@${version}`));
|
|
72683
|
+
} catch (err) {
|
|
72684
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
72685
|
+
logger.info(import_picocolors19.default.yellow(`⚠ GitHub Packages smoke failed: ${msg.split(`
|
|
72686
|
+
`)[0]}
|
|
72687
|
+
Check token has 'read:packages' scope and is not expired.`));
|
|
72688
|
+
}
|
|
72689
|
+
}
|
|
72690
|
+
async function writeNpmrcWithToken(pat, source) {
|
|
72691
|
+
const npmrcPath = join96(homedir45(), ".npmrc");
|
|
72692
|
+
try {
|
|
72693
|
+
const result = await writeNpmrc(npmrcPath, buildGitHubPackagesEntries(pat));
|
|
72694
|
+
if (result.noChange) {
|
|
72695
|
+
logger.info(import_picocolors19.default.dim("~/.npmrc already up to date"));
|
|
72696
|
+
} else {
|
|
72697
|
+
logger.info(import_picocolors19.default.green(`Wrote GitHub Packages config → ${npmrcPath}`));
|
|
72698
|
+
if (result.backupPath)
|
|
72699
|
+
logger.info(import_picocolors19.default.dim(` backup: ${result.backupPath}`));
|
|
72700
|
+
}
|
|
72701
|
+
await smokeGitHubPackagesAuth();
|
|
72702
|
+
return result.noChange ? { status: "no-change", source } : { status: "written", backupPath: result.backupPath, source };
|
|
72703
|
+
} catch (err) {
|
|
72704
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
72705
|
+
logger.error(`Failed to write ~/.npmrc: ${msg}`);
|
|
72706
|
+
return { status: "error", error: msg, source };
|
|
72707
|
+
}
|
|
72708
|
+
}
|
|
72709
|
+
async function runNpmrcSetupStep(opts = {}) {
|
|
72710
|
+
if (process.env.FQC_QA_SKIP_NPMRC === "1") {
|
|
72711
|
+
logger.info(import_picocolors19.default.dim("Skipping ~/.npmrc bootstrap (FQC_QA_SKIP_NPMRC=1)"));
|
|
72712
|
+
return { status: "skipped-env" };
|
|
72713
|
+
}
|
|
72714
|
+
const fromEnv = resolveTokenFromEnv();
|
|
72715
|
+
if (fromEnv) {
|
|
72716
|
+
if (!isValidGitHubPat(fromEnv.token)) {
|
|
72717
|
+
logger.info(import_picocolors19.default.yellow(`${TOKEN_ENV_KEY} (from ${fromEnv.source === "env" ? "process.env" : ".env"}) is not a valid GitHub PAT — falling back to interactive prompt.`));
|
|
72718
|
+
} else {
|
|
72719
|
+
logger.info(import_picocolors19.default.dim(`Using ${TOKEN_ENV_KEY} from ${fromEnv.source === "env" ? "process.env" : "<cwd>/.env"} — skipping prompt.`));
|
|
72720
|
+
return writeNpmrcWithToken(fromEnv.token, fromEnv.source);
|
|
72721
|
+
}
|
|
72722
|
+
}
|
|
72723
|
+
console.log("");
|
|
72724
|
+
le([
|
|
72725
|
+
"To resolve @chiendt1108/fqc-mcp-servers from GitHub Packages, ~/.npmrc",
|
|
72726
|
+
"needs a scope mapping and a GitHub PAT with the `read:packages` scope.",
|
|
72727
|
+
"Create one at: https://github.com/settings/tokens (classic) or",
|
|
72728
|
+
"https://github.com/settings/personal-access-tokens/new (fine-grained).",
|
|
72729
|
+
"",
|
|
72730
|
+
"Press Enter / Esc to skip — rerun later with `ack fqc-qa-setup --npmrc-only`."
|
|
72731
|
+
].join(`
|
|
72732
|
+
`), "GitHub Packages auth");
|
|
72733
|
+
if (opts.yes) {
|
|
72734
|
+
logger.info(import_picocolors19.default.yellow("--yes given — skipping interactive PAT prompt."));
|
|
72735
|
+
return { status: "skipped-cancel" };
|
|
72736
|
+
}
|
|
72737
|
+
const proceed = await se({
|
|
72738
|
+
message: "Set up GitHub Packages auth now?",
|
|
72739
|
+
initialValue: true
|
|
72740
|
+
});
|
|
72741
|
+
if (lD(proceed) || proceed === false) {
|
|
72742
|
+
logger.info(import_picocolors19.default.yellow("Skipped. Rerun with `ack fqc-qa-setup --npmrc-only` when ready."));
|
|
72743
|
+
return { status: "skipped-cancel" };
|
|
72744
|
+
}
|
|
72745
|
+
const pat = await re({
|
|
72746
|
+
message: "GitHub Personal Access Token (read:packages):",
|
|
72747
|
+
validate: (value) => {
|
|
72748
|
+
if (!value)
|
|
72749
|
+
return;
|
|
72750
|
+
if (!isValidGitHubPat(value)) {
|
|
72751
|
+
return "Token must start with ghp_, github_pat_, ghs_, gho_, ghu_, or ghr_.";
|
|
72752
|
+
}
|
|
72753
|
+
return;
|
|
72754
|
+
}
|
|
72755
|
+
});
|
|
72756
|
+
if (lD(pat) || !pat) {
|
|
72757
|
+
logger.info(import_picocolors19.default.yellow("Skipped PAT entry. Rerun with `ack fqc-qa-setup --npmrc-only` when ready."));
|
|
72758
|
+
return { status: "skipped-cancel" };
|
|
72759
|
+
}
|
|
72760
|
+
return writeNpmrcWithToken(pat, "prompt");
|
|
72761
|
+
}
|
|
72762
|
+
var import_picocolors19, execFileP, TOKEN_ENV_KEY = "FQC_GITHUB_PACKAGES_TOKEN";
|
|
72763
|
+
var init_npmrc_setup_step = __esm(() => {
|
|
72764
|
+
init_npmrc_bootstrap();
|
|
72765
|
+
init_logger();
|
|
72766
|
+
init_dist2();
|
|
72767
|
+
import_picocolors19 = __toESM(require_picocolors(), 1);
|
|
72768
|
+
execFileP = promisify12(execFile10);
|
|
72769
|
+
});
|
|
72770
|
+
|
|
72530
72771
|
// node_modules/picomatch/lib/constants.js
|
|
72531
72772
|
var require_constants3 = __commonJS((exports, module) => {
|
|
72532
72773
|
var WIN_SLASH = "\\\\/";
|
|
@@ -74482,7 +74723,7 @@ var init_opencode_installer = __esm(() => {
|
|
|
74482
74723
|
var PARTIAL_INSTALL_VERSION = "partial", EXIT_CODE_CRITICAL_FAILURE = 1, EXIT_CODE_PARTIAL_SUCCESS = 2;
|
|
74483
74724
|
|
|
74484
74725
|
// src/services/package-installer/install-error-handler.ts
|
|
74485
|
-
import { existsSync as
|
|
74726
|
+
import { existsSync as existsSync67, readFileSync as readFileSync21, unlinkSync as unlinkSync4 } from "node:fs";
|
|
74486
74727
|
import { join as join100 } from "node:path";
|
|
74487
74728
|
function parseNameReason(str2) {
|
|
74488
74729
|
const colonIndex = str2.indexOf(":");
|
|
@@ -74547,13 +74788,13 @@ function getSystemPackageCommands(summary, systemFailures) {
|
|
|
74547
74788
|
}
|
|
74548
74789
|
function displayInstallErrors(skillsDir) {
|
|
74549
74790
|
const summaryPath = join100(skillsDir, ".install-error-summary.json");
|
|
74550
|
-
if (!
|
|
74791
|
+
if (!existsSync67(summaryPath)) {
|
|
74551
74792
|
logger.error("Skills installation failed. Run with --verbose for details.");
|
|
74552
74793
|
return;
|
|
74553
74794
|
}
|
|
74554
74795
|
let summary;
|
|
74555
74796
|
try {
|
|
74556
|
-
summary = JSON.parse(
|
|
74797
|
+
summary = JSON.parse(readFileSync21(summaryPath, "utf-8"));
|
|
74557
74798
|
} catch (parseError) {
|
|
74558
74799
|
logger.error("Failed to parse error summary. File may be corrupted.");
|
|
74559
74800
|
logger.debug(`Parse error: ${parseError instanceof Error ? parseError.message : String(parseError)}`);
|
|
@@ -74632,8 +74873,8 @@ async function checkNeedsSudoPackages() {
|
|
|
74632
74873
|
return false;
|
|
74633
74874
|
}
|
|
74634
74875
|
const { exec: exec5 } = await import("node:child_process");
|
|
74635
|
-
const { promisify:
|
|
74636
|
-
const execAsync5 =
|
|
74876
|
+
const { promisify: promisify13 } = await import("node:util");
|
|
74877
|
+
const execAsync5 = promisify13(exec5);
|
|
74637
74878
|
try {
|
|
74638
74879
|
await Promise.all([
|
|
74639
74880
|
execAsync5("which ffmpeg", { timeout: WHICH_COMMAND_TIMEOUT_MS }),
|
|
@@ -74646,7 +74887,7 @@ async function checkNeedsSudoPackages() {
|
|
|
74646
74887
|
}
|
|
74647
74888
|
function hasInstallState(skillsDir) {
|
|
74648
74889
|
const stateFilePath = join100(skillsDir, ".install-state.json");
|
|
74649
|
-
return
|
|
74890
|
+
return existsSync67(stateFilePath);
|
|
74650
74891
|
}
|
|
74651
74892
|
var WHICH_COMMAND_TIMEOUT_MS = 5000, WINDOWS_SYSTEM_PACKAGES, SYSTEM_TOOL_KEYS, WINDOWS_RSVG_COMMANDS;
|
|
74652
74893
|
var init_install_error_handler = __esm(() => {
|
|
@@ -74685,7 +74926,7 @@ async function installSkillsDependencies(skillsDir, options2 = {}) {
|
|
|
74685
74926
|
};
|
|
74686
74927
|
}
|
|
74687
74928
|
try {
|
|
74688
|
-
const { existsSync:
|
|
74929
|
+
const { existsSync: existsSync68 } = await import("node:fs");
|
|
74689
74930
|
const clack = await Promise.resolve().then(() => (init_dist2(), exports_dist));
|
|
74690
74931
|
const platform9 = process.platform;
|
|
74691
74932
|
const scriptName = platform9 === "win32" ? "install.ps1" : "install.sh";
|
|
@@ -74701,7 +74942,7 @@ async function installSkillsDependencies(skillsDir, options2 = {}) {
|
|
|
74701
74942
|
error: `Path validation failed: ${errorMessage}`
|
|
74702
74943
|
};
|
|
74703
74944
|
}
|
|
74704
|
-
if (!
|
|
74945
|
+
if (!existsSync68(scriptPath)) {
|
|
74705
74946
|
logger.warning(`Skills installation script not found: ${scriptPath}`);
|
|
74706
74947
|
logger.info("");
|
|
74707
74948
|
logger.info("\uD83D\uDCD6 Manual Installation Instructions:");
|
|
@@ -74917,7 +75158,7 @@ var init_skills_installer2 = __esm(() => {
|
|
|
74917
75158
|
});
|
|
74918
75159
|
|
|
74919
75160
|
// src/services/package-installer/gemini-mcp/config-manager.ts
|
|
74920
|
-
import { existsSync as
|
|
75161
|
+
import { existsSync as existsSync68 } from "node:fs";
|
|
74921
75162
|
import { mkdir as mkdir24, readFile as readFile50, writeFile as writeFile25 } from "node:fs/promises";
|
|
74922
75163
|
import { dirname as dirname33, join as join102 } from "node:path";
|
|
74923
75164
|
async function readJsonFile(filePath) {
|
|
@@ -74935,7 +75176,7 @@ async function addGeminiToGitignore(projectDir) {
|
|
|
74935
75176
|
const geminiPattern = ".gemini/";
|
|
74936
75177
|
try {
|
|
74937
75178
|
let content = "";
|
|
74938
|
-
if (
|
|
75179
|
+
if (existsSync68(gitignorePath)) {
|
|
74939
75180
|
content = await readFile50(gitignorePath, "utf-8");
|
|
74940
75181
|
const lines = content.split(`
|
|
74941
75182
|
`).map((line) => line.trim()).filter((line) => !line.startsWith("#"));
|
|
@@ -74960,7 +75201,7 @@ ${geminiPattern}
|
|
|
74960
75201
|
}
|
|
74961
75202
|
async function createNewSettingsWithMerge(geminiSettingsPath, mcpConfigPath) {
|
|
74962
75203
|
const linkDir = dirname33(geminiSettingsPath);
|
|
74963
|
-
if (!
|
|
75204
|
+
if (!existsSync68(linkDir)) {
|
|
74964
75205
|
await mkdir24(linkDir, { recursive: true });
|
|
74965
75206
|
logger.debug(`Created directory: ${linkDir}`);
|
|
74966
75207
|
}
|
|
@@ -75021,7 +75262,7 @@ var init_config_manager2 = __esm(() => {
|
|
|
75021
75262
|
});
|
|
75022
75263
|
|
|
75023
75264
|
// src/services/package-installer/gemini-mcp/validation.ts
|
|
75024
|
-
import { existsSync as
|
|
75265
|
+
import { existsSync as existsSync69, lstatSync, readlinkSync } from "node:fs";
|
|
75025
75266
|
import { homedir as homedir46 } from "node:os";
|
|
75026
75267
|
import { join as join103 } from "node:path";
|
|
75027
75268
|
function getGlobalMcpConfigPath() {
|
|
@@ -75032,12 +75273,12 @@ function getLocalMcpConfigPath(projectDir) {
|
|
|
75032
75273
|
}
|
|
75033
75274
|
function findMcpConfigPath(projectDir) {
|
|
75034
75275
|
const localPath = getLocalMcpConfigPath(projectDir);
|
|
75035
|
-
if (
|
|
75276
|
+
if (existsSync69(localPath)) {
|
|
75036
75277
|
logger.debug(`Found local MCP config: ${localPath}`);
|
|
75037
75278
|
return localPath;
|
|
75038
75279
|
}
|
|
75039
75280
|
const globalPath = getGlobalMcpConfigPath();
|
|
75040
|
-
if (
|
|
75281
|
+
if (existsSync69(globalPath)) {
|
|
75041
75282
|
logger.debug(`Found global MCP config: ${globalPath}`);
|
|
75042
75283
|
return globalPath;
|
|
75043
75284
|
}
|
|
@@ -75052,7 +75293,7 @@ function getGeminiSettingsPath(projectDir, isGlobal) {
|
|
|
75052
75293
|
}
|
|
75053
75294
|
function checkExistingGeminiConfig(projectDir, isGlobal = false) {
|
|
75054
75295
|
const geminiSettingsPath = getGeminiSettingsPath(projectDir, isGlobal);
|
|
75055
|
-
if (!
|
|
75296
|
+
if (!existsSync69(geminiSettingsPath)) {
|
|
75056
75297
|
return { exists: false, isSymlink: false, settingsPath: geminiSettingsPath };
|
|
75057
75298
|
}
|
|
75058
75299
|
try {
|
|
@@ -75076,12 +75317,12 @@ var init_validation = __esm(() => {
|
|
|
75076
75317
|
});
|
|
75077
75318
|
|
|
75078
75319
|
// src/services/package-installer/gemini-mcp/linker-core.ts
|
|
75079
|
-
import { existsSync as
|
|
75320
|
+
import { existsSync as existsSync70 } from "node:fs";
|
|
75080
75321
|
import { mkdir as mkdir25, symlink as symlink3 } from "node:fs/promises";
|
|
75081
75322
|
import { dirname as dirname34, join as join104 } from "node:path";
|
|
75082
75323
|
async function createSymlink(targetPath, linkPath, projectDir, isGlobal) {
|
|
75083
75324
|
const linkDir = dirname34(linkPath);
|
|
75084
|
-
if (!
|
|
75325
|
+
if (!existsSync70(linkDir)) {
|
|
75085
75326
|
await mkdir25(linkDir, { recursive: true });
|
|
75086
75327
|
logger.debug(`Created directory: ${linkDir}`);
|
|
75087
75328
|
}
|
|
@@ -77131,11 +77372,11 @@ var require_extract_zip = __commonJS((exports, module) => {
|
|
|
77131
77372
|
var { createWriteStream: createWriteStream3, promises: fs15 } = __require("fs");
|
|
77132
77373
|
var getStream = require_get_stream();
|
|
77133
77374
|
var path9 = __require("path");
|
|
77134
|
-
var { promisify:
|
|
77375
|
+
var { promisify: promisify13 } = __require("util");
|
|
77135
77376
|
var stream = __require("stream");
|
|
77136
77377
|
var yauzl = require_yauzl();
|
|
77137
|
-
var openZip =
|
|
77138
|
-
var pipeline =
|
|
77378
|
+
var openZip = promisify13(yauzl.open);
|
|
77379
|
+
var pipeline = promisify13(stream.pipeline);
|
|
77139
77380
|
|
|
77140
77381
|
class Extractor {
|
|
77141
77382
|
constructor(zipPath, opts) {
|
|
@@ -77220,7 +77461,7 @@ var require_extract_zip = __commonJS((exports, module) => {
|
|
|
77220
77461
|
if (isDir)
|
|
77221
77462
|
return;
|
|
77222
77463
|
debug("opening read stream", dest);
|
|
77223
|
-
const readStream = await
|
|
77464
|
+
const readStream = await promisify13(this.zipfile.openReadStream.bind(this.zipfile))(entry);
|
|
77224
77465
|
if (symlink4) {
|
|
77225
77466
|
const link = await getStream(readStream);
|
|
77226
77467
|
debug("creating symlink", link, dest);
|
|
@@ -77504,7 +77745,7 @@ __export(exports_worktree_manager, {
|
|
|
77504
77745
|
createWorktree: () => createWorktree,
|
|
77505
77746
|
cleanupAllWorktrees: () => cleanupAllWorktrees
|
|
77506
77747
|
});
|
|
77507
|
-
import { existsSync as
|
|
77748
|
+
import { existsSync as existsSync79 } from "node:fs";
|
|
77508
77749
|
import { readFile as readFile70, writeFile as writeFile40 } from "node:fs/promises";
|
|
77509
77750
|
import { join as join162 } from "node:path";
|
|
77510
77751
|
async function createWorktree(projectDir, issueNumber, baseBranch) {
|
|
@@ -77570,7 +77811,7 @@ async function cleanupAllWorktrees(projectDir) {
|
|
|
77570
77811
|
async function ensureGitignore(projectDir) {
|
|
77571
77812
|
const gitignorePath = join162(projectDir, ".gitignore");
|
|
77572
77813
|
try {
|
|
77573
|
-
const content =
|
|
77814
|
+
const content = existsSync79(gitignorePath) ? await readFile70(gitignorePath, "utf-8") : "";
|
|
77574
77815
|
if (!content.includes(".worktrees")) {
|
|
77575
77816
|
const newContent = content.endsWith(`
|
|
77576
77817
|
`) ? `${content}.worktrees/
|
|
@@ -77672,16 +77913,16 @@ var init_content_validator = __esm(() => {
|
|
|
77672
77913
|
|
|
77673
77914
|
// src/commands/content/phases/context-cache-manager.ts
|
|
77674
77915
|
import { createHash as createHash10 } from "node:crypto";
|
|
77675
|
-
import { existsSync as
|
|
77916
|
+
import { existsSync as existsSync85, mkdirSync as mkdirSync5, readFileSync as readFileSync22, readdirSync as readdirSync12, statSync as statSync15 } from "node:fs";
|
|
77676
77917
|
import { rename as rename17, writeFile as writeFile42 } from "node:fs/promises";
|
|
77677
77918
|
import { homedir as homedir56 } from "node:os";
|
|
77678
77919
|
import { basename as basename34, join as join169 } from "node:path";
|
|
77679
77920
|
function getCachedContext(repoPath) {
|
|
77680
77921
|
const cachePath = getCacheFilePath(repoPath);
|
|
77681
|
-
if (!
|
|
77922
|
+
if (!existsSync85(cachePath))
|
|
77682
77923
|
return null;
|
|
77683
77924
|
try {
|
|
77684
|
-
const raw =
|
|
77925
|
+
const raw = readFileSync22(cachePath, "utf-8");
|
|
77685
77926
|
const cache4 = JSON.parse(raw);
|
|
77686
77927
|
const age = Date.now() - new Date(cache4.createdAt).getTime();
|
|
77687
77928
|
if (age >= CACHE_TTL_MS5)
|
|
@@ -77695,7 +77936,7 @@ function getCachedContext(repoPath) {
|
|
|
77695
77936
|
}
|
|
77696
77937
|
}
|
|
77697
77938
|
async function saveCachedContext(repoPath, cache4) {
|
|
77698
|
-
if (!
|
|
77939
|
+
if (!existsSync85(CACHE_DIR)) {
|
|
77699
77940
|
mkdirSync5(CACHE_DIR, { recursive: true });
|
|
77700
77941
|
}
|
|
77701
77942
|
const cachePath = getCacheFilePath(repoPath);
|
|
@@ -77719,7 +77960,7 @@ function computeSourceHash(repoPath) {
|
|
|
77719
77960
|
function getDocSourcePaths(repoPath) {
|
|
77720
77961
|
const paths = [];
|
|
77721
77962
|
const docsDir = join169(repoPath, "docs");
|
|
77722
|
-
if (
|
|
77963
|
+
if (existsSync85(docsDir)) {
|
|
77723
77964
|
try {
|
|
77724
77965
|
const files = readdirSync12(docsDir);
|
|
77725
77966
|
for (const f4 of files) {
|
|
@@ -77729,10 +77970,10 @@ function getDocSourcePaths(repoPath) {
|
|
|
77729
77970
|
} catch {}
|
|
77730
77971
|
}
|
|
77731
77972
|
const readme = join169(repoPath, "README.md");
|
|
77732
|
-
if (
|
|
77973
|
+
if (existsSync85(readme))
|
|
77733
77974
|
paths.push(readme);
|
|
77734
77975
|
const stylesDir = join169(repoPath, "assets", "writing-styles");
|
|
77735
|
-
if (
|
|
77976
|
+
if (existsSync85(stylesDir)) {
|
|
77736
77977
|
try {
|
|
77737
77978
|
const files = readdirSync12(stylesDir);
|
|
77738
77979
|
for (const f4 of files) {
|
|
@@ -77929,7 +78170,7 @@ function extractContentFromResponse(response) {
|
|
|
77929
78170
|
|
|
77930
78171
|
// src/commands/content/phases/docs-summarizer.ts
|
|
77931
78172
|
import { execSync as execSync6 } from "node:child_process";
|
|
77932
|
-
import { existsSync as
|
|
78173
|
+
import { existsSync as existsSync86, readFileSync as readFileSync23, readdirSync as readdirSync13 } from "node:fs";
|
|
77933
78174
|
import { join as join170 } from "node:path";
|
|
77934
78175
|
async function summarizeProjectDocs(repoPath, contentLogger) {
|
|
77935
78176
|
const rawContent = collectRawDocs(repoPath);
|
|
@@ -77974,18 +78215,18 @@ async function summarizeProjectDocs(repoPath, contentLogger) {
|
|
|
77974
78215
|
function collectRawDocs(repoPath) {
|
|
77975
78216
|
let totalChars = 0;
|
|
77976
78217
|
const readCapped = (filePath, maxChars) => {
|
|
77977
|
-
if (!
|
|
78218
|
+
if (!existsSync86(filePath))
|
|
77978
78219
|
return "";
|
|
77979
78220
|
if (totalChars >= MAX_RAW_CONTENT_CHARS)
|
|
77980
78221
|
return "";
|
|
77981
|
-
const content =
|
|
78222
|
+
const content = readFileSync23(filePath, "utf-8");
|
|
77982
78223
|
const capped = content.slice(0, Math.min(maxChars, MAX_RAW_CONTENT_CHARS - totalChars));
|
|
77983
78224
|
totalChars += capped.length;
|
|
77984
78225
|
return capped;
|
|
77985
78226
|
};
|
|
77986
78227
|
const docsContent = [];
|
|
77987
78228
|
const docsDir = join170(repoPath, "docs");
|
|
77988
|
-
if (
|
|
78229
|
+
if (existsSync86(docsDir)) {
|
|
77989
78230
|
try {
|
|
77990
78231
|
const files = readdirSync13(docsDir).filter((f4) => f4.endsWith(".md")).sort();
|
|
77991
78232
|
for (const f4 of files) {
|
|
@@ -78009,7 +78250,7 @@ ${content}`);
|
|
|
78009
78250
|
}
|
|
78010
78251
|
let styles3 = "";
|
|
78011
78252
|
const stylesDir = join170(repoPath, "assets", "writing-styles");
|
|
78012
|
-
if (
|
|
78253
|
+
if (existsSync86(stylesDir)) {
|
|
78013
78254
|
try {
|
|
78014
78255
|
const files = readdirSync13(stylesDir).slice(0, 3);
|
|
78015
78256
|
styles3 = files.map((f4) => readCapped(join170(stylesDir, f4), 1000)).filter(Boolean).join(`
|
|
@@ -78202,12 +78443,12 @@ IMPORTANT: Generate the image and output the path as JSON: {"imagePath": "/path/
|
|
|
78202
78443
|
|
|
78203
78444
|
// src/commands/content/phases/photo-generator.ts
|
|
78204
78445
|
import { execSync as execSync7 } from "node:child_process";
|
|
78205
|
-
import { existsSync as
|
|
78446
|
+
import { existsSync as existsSync87, mkdirSync as mkdirSync6, readdirSync as readdirSync14 } from "node:fs";
|
|
78206
78447
|
import { homedir as homedir57 } from "node:os";
|
|
78207
78448
|
import { join as join171 } from "node:path";
|
|
78208
78449
|
async function generatePhoto(_content, context, config, platform14, contentId, contentLogger) {
|
|
78209
78450
|
const mediaDir = join171(config.contentDir.replace(/^~/, homedir57()), "media", String(contentId));
|
|
78210
|
-
if (!
|
|
78451
|
+
if (!existsSync87(mediaDir)) {
|
|
78211
78452
|
mkdirSync6(mediaDir, { recursive: true });
|
|
78212
78453
|
}
|
|
78213
78454
|
const prompt = buildPhotoPrompt(context, platform14);
|
|
@@ -78223,7 +78464,7 @@ async function generatePhoto(_content, context, config, platform14, contentId, c
|
|
|
78223
78464
|
const parsed = parseClaudeJsonOutput(result);
|
|
78224
78465
|
if (parsed && typeof parsed === "object" && "imagePath" in parsed) {
|
|
78225
78466
|
const imagePath = String(parsed.imagePath);
|
|
78226
|
-
if (
|
|
78467
|
+
if (existsSync87(imagePath)) {
|
|
78227
78468
|
return { path: imagePath, ...dimensions, format: "png" };
|
|
78228
78469
|
}
|
|
78229
78470
|
}
|
|
@@ -78319,7 +78560,7 @@ var init_content_creator = __esm(() => {
|
|
|
78319
78560
|
});
|
|
78320
78561
|
|
|
78321
78562
|
// src/commands/content/phases/content-logger.ts
|
|
78322
|
-
import { createWriteStream as createWriteStream4, existsSync as
|
|
78563
|
+
import { createWriteStream as createWriteStream4, existsSync as existsSync88, mkdirSync as mkdirSync7, statSync as statSync16 } from "node:fs";
|
|
78323
78564
|
import { homedir as homedir58 } from "node:os";
|
|
78324
78565
|
import { join as join172 } from "node:path";
|
|
78325
78566
|
|
|
@@ -78333,7 +78574,7 @@ class ContentLogger {
|
|
|
78333
78574
|
this.maxBytes = maxBytes;
|
|
78334
78575
|
}
|
|
78335
78576
|
init() {
|
|
78336
|
-
if (!
|
|
78577
|
+
if (!existsSync88(this.logDir)) {
|
|
78337
78578
|
mkdirSync7(this.logDir, { recursive: true });
|
|
78338
78579
|
}
|
|
78339
78580
|
this.rotateIfNeeded();
|
|
@@ -78426,7 +78667,7 @@ function openDatabase(dbPath) {
|
|
|
78426
78667
|
var init_sqlite_client = () => {};
|
|
78427
78668
|
|
|
78428
78669
|
// src/commands/content/phases/db-manager.ts
|
|
78429
|
-
import { existsSync as
|
|
78670
|
+
import { existsSync as existsSync89, mkdirSync as mkdirSync8 } from "node:fs";
|
|
78430
78671
|
import { dirname as dirname51 } from "node:path";
|
|
78431
78672
|
function initDatabase(dbPath) {
|
|
78432
78673
|
ensureParentDir(dbPath);
|
|
@@ -78449,7 +78690,7 @@ function runRetentionCleanup(db, retentionDays = 90) {
|
|
|
78449
78690
|
}
|
|
78450
78691
|
function ensureParentDir(dbPath) {
|
|
78451
78692
|
const dir = dirname51(dbPath);
|
|
78452
|
-
if (dir && !
|
|
78693
|
+
if (dir && !existsSync89(dir)) {
|
|
78453
78694
|
mkdirSync8(dir, { recursive: true });
|
|
78454
78695
|
}
|
|
78455
78696
|
}
|
|
@@ -78614,7 +78855,7 @@ function isNoiseCommit(title, author) {
|
|
|
78614
78855
|
|
|
78615
78856
|
// src/commands/content/phases/change-detector.ts
|
|
78616
78857
|
import { execFileSync as execFileSync4, spawnSync as spawnSync9 } from "node:child_process";
|
|
78617
|
-
import { existsSync as
|
|
78858
|
+
import { existsSync as existsSync90, readFileSync as readFileSync24, readdirSync as readdirSync15, statSync as statSync17 } from "node:fs";
|
|
78618
78859
|
import { join as join173 } from "node:path";
|
|
78619
78860
|
function detectCommits(repo, since) {
|
|
78620
78861
|
try {
|
|
@@ -78747,7 +78988,7 @@ function detectTags(repo, since) {
|
|
|
78747
78988
|
}
|
|
78748
78989
|
function detectCompletedPlans(repo, since) {
|
|
78749
78990
|
const plansDir = join173(repo.path, "plans");
|
|
78750
|
-
if (!
|
|
78991
|
+
if (!existsSync90(plansDir))
|
|
78751
78992
|
return [];
|
|
78752
78993
|
const sinceMs = new Date(since).getTime();
|
|
78753
78994
|
const events = [];
|
|
@@ -78757,13 +78998,13 @@ function detectCompletedPlans(repo, since) {
|
|
|
78757
78998
|
if (!entry.isDirectory())
|
|
78758
78999
|
continue;
|
|
78759
79000
|
const planFile = join173(plansDir, entry.name, "plan.md");
|
|
78760
|
-
if (!
|
|
79001
|
+
if (!existsSync90(planFile))
|
|
78761
79002
|
continue;
|
|
78762
79003
|
try {
|
|
78763
79004
|
const stat26 = statSync17(planFile);
|
|
78764
79005
|
if (stat26.mtimeMs < sinceMs)
|
|
78765
79006
|
continue;
|
|
78766
|
-
const content =
|
|
79007
|
+
const content = readFileSync24(planFile, "utf-8");
|
|
78767
79008
|
const frontmatterMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
78768
79009
|
if (!frontmatterMatch)
|
|
78769
79010
|
continue;
|
|
@@ -79795,7 +80036,7 @@ var init_platform_setup_x = __esm(() => {
|
|
|
79795
80036
|
});
|
|
79796
80037
|
|
|
79797
80038
|
// src/commands/content/phases/setup-wizard.ts
|
|
79798
|
-
import { existsSync as
|
|
80039
|
+
import { existsSync as existsSync91 } from "node:fs";
|
|
79799
80040
|
import { join as join176 } from "node:path";
|
|
79800
80041
|
async function runSetupWizard2(cwd2, contentLogger) {
|
|
79801
80042
|
console.log();
|
|
@@ -79864,8 +80105,8 @@ async function showRepoSummary(cwd2) {
|
|
|
79864
80105
|
function detectBrandAssets(cwd2, contentLogger) {
|
|
79865
80106
|
const repos = discoverRepos2(cwd2);
|
|
79866
80107
|
for (const repo of repos) {
|
|
79867
|
-
const hasGuidelines =
|
|
79868
|
-
const hasStyles =
|
|
80108
|
+
const hasGuidelines = existsSync91(join176(repo.path, "docs", "brand-guidelines.md"));
|
|
80109
|
+
const hasStyles = existsSync91(join176(repo.path, "assets", "writing-styles"));
|
|
79869
80110
|
if (!hasGuidelines) {
|
|
79870
80111
|
f2.warning(`${repo.name}: No docs/brand-guidelines.md — content will use generic tone.`);
|
|
79871
80112
|
contentLogger.warn(`${repo.name}: missing docs/brand-guidelines.md`);
|
|
@@ -79931,13 +80172,13 @@ var init_setup_wizard = __esm(() => {
|
|
|
79931
80172
|
});
|
|
79932
80173
|
|
|
79933
80174
|
// src/commands/content/content-review-commands.ts
|
|
79934
|
-
import { existsSync as
|
|
80175
|
+
import { existsSync as existsSync92 } from "node:fs";
|
|
79935
80176
|
import { homedir as homedir59 } from "node:os";
|
|
79936
80177
|
async function queueContent() {
|
|
79937
80178
|
const cwd2 = process.cwd();
|
|
79938
80179
|
const config = await loadContentConfig(cwd2);
|
|
79939
80180
|
const dbPath = config.dbPath.replace(/^~/, homedir59());
|
|
79940
|
-
if (!
|
|
80181
|
+
if (!existsSync92(dbPath)) {
|
|
79941
80182
|
logger.info("No content database found. Run 'ack content setup' first.");
|
|
79942
80183
|
return;
|
|
79943
80184
|
}
|
|
@@ -80005,15 +80246,15 @@ __export(exports_content_subcommands, {
|
|
|
80005
80246
|
logsContent: () => logsContent,
|
|
80006
80247
|
approveContentCmd: () => approveContentCmd
|
|
80007
80248
|
});
|
|
80008
|
-
import { existsSync as
|
|
80249
|
+
import { existsSync as existsSync93, readFileSync as readFileSync25, unlinkSync as unlinkSync7 } from "node:fs";
|
|
80009
80250
|
import { homedir as homedir60 } from "node:os";
|
|
80010
80251
|
import { join as join177 } from "node:path";
|
|
80011
80252
|
function isDaemonRunning() {
|
|
80012
80253
|
const lockFile = join177(LOCK_DIR, `${LOCK_NAME2}.lock`);
|
|
80013
|
-
if (!
|
|
80254
|
+
if (!existsSync93(lockFile))
|
|
80014
80255
|
return { running: false, pid: null };
|
|
80015
80256
|
try {
|
|
80016
|
-
const pidStr =
|
|
80257
|
+
const pidStr = readFileSync25(lockFile, "utf-8").trim();
|
|
80017
80258
|
const pid = Number.parseInt(pidStr, 10);
|
|
80018
80259
|
if (Number.isNaN(pid)) {
|
|
80019
80260
|
unlinkSync7(lockFile);
|
|
@@ -80042,12 +80283,12 @@ async function startContent(options2) {
|
|
|
80042
80283
|
}
|
|
80043
80284
|
async function stopContent() {
|
|
80044
80285
|
const lockFile = join177(LOCK_DIR, `${LOCK_NAME2}.lock`);
|
|
80045
|
-
if (!
|
|
80286
|
+
if (!existsSync93(lockFile)) {
|
|
80046
80287
|
logger.info("Content daemon is not running.");
|
|
80047
80288
|
return;
|
|
80048
80289
|
}
|
|
80049
80290
|
try {
|
|
80050
|
-
const pidStr =
|
|
80291
|
+
const pidStr = readFileSync25(lockFile, "utf-8").trim();
|
|
80051
80292
|
const pid = Number.parseInt(pidStr, 10);
|
|
80052
80293
|
if (!Number.isNaN(pid)) {
|
|
80053
80294
|
process.kill(pid, "SIGTERM");
|
|
@@ -80083,7 +80324,7 @@ async function logsContent(options2) {
|
|
|
80083
80324
|
const logDir = join177(homedir60(), ".ack", "logs");
|
|
80084
80325
|
const dateStr = new Date().toISOString().slice(0, 10).replace(/-/g, "");
|
|
80085
80326
|
const logPath = join177(logDir, `content-${dateStr}.log`);
|
|
80086
|
-
if (!
|
|
80327
|
+
if (!existsSync93(logPath)) {
|
|
80087
80328
|
logger.info("No content logs found for today.");
|
|
80088
80329
|
return;
|
|
80089
80330
|
}
|
|
@@ -80095,7 +80336,7 @@ async function logsContent(options2) {
|
|
|
80095
80336
|
process.exit(0);
|
|
80096
80337
|
});
|
|
80097
80338
|
} else {
|
|
80098
|
-
const content =
|
|
80339
|
+
const content = readFileSync25(logPath, "utf-8");
|
|
80099
80340
|
console.log(content);
|
|
80100
80341
|
}
|
|
80101
80342
|
}
|
|
@@ -80118,7 +80359,7 @@ var init_content_subcommands = __esm(() => {
|
|
|
80118
80359
|
});
|
|
80119
80360
|
|
|
80120
80361
|
// src/commands/content/content-command.ts
|
|
80121
|
-
import { existsSync as
|
|
80362
|
+
import { existsSync as existsSync94, mkdirSync as mkdirSync9, unlinkSync as unlinkSync8, writeFileSync as writeFileSync10 } from "node:fs";
|
|
80122
80363
|
import { homedir as homedir61 } from "node:os";
|
|
80123
80364
|
import { join as join178 } from "node:path";
|
|
80124
80365
|
async function contentCommand(options2) {
|
|
@@ -80149,7 +80390,7 @@ async function contentCommand(options2) {
|
|
|
80149
80390
|
}
|
|
80150
80391
|
contentLogger.info("Setup complete. Starting daemon...");
|
|
80151
80392
|
}
|
|
80152
|
-
if (!
|
|
80393
|
+
if (!existsSync94(LOCK_DIR2))
|
|
80153
80394
|
mkdirSync9(LOCK_DIR2, { recursive: true });
|
|
80154
80395
|
writeFileSync10(LOCK_FILE, String(process.pid), "utf-8");
|
|
80155
80396
|
const dbPath = config.dbPath.replace(/^~/, homedir61());
|
|
@@ -90791,114 +91032,12 @@ function buildCheckResult(result) {
|
|
|
90791
91032
|
};
|
|
90792
91033
|
}
|
|
90793
91034
|
// src/domains/health-checks/checkers/npmrc-github-packages-checker.ts
|
|
91035
|
+
init_npmrc_bootstrap();
|
|
91036
|
+
init_environment();
|
|
90794
91037
|
import { spawn as spawn4 } from "node:child_process";
|
|
90795
91038
|
import { promises as fs11 } from "node:fs";
|
|
90796
91039
|
import { homedir as homedir44 } from "node:os";
|
|
90797
91040
|
import { join as join89 } from "node:path";
|
|
90798
|
-
|
|
90799
|
-
// src/domains/installation/npmrc-bootstrap.ts
|
|
90800
|
-
import { promises as fs10 } from "node:fs";
|
|
90801
|
-
import { dirname as dirname29 } from "node:path";
|
|
90802
|
-
var GITHUB_PACKAGES_REGISTRY_URL = "https://npm.pkg.github.com";
|
|
90803
|
-
var GITHUB_PACKAGES_SCOPE = "@chiendt1108";
|
|
90804
|
-
var SCOPE_REGISTRY_KEY = `${GITHUB_PACKAGES_SCOPE}:registry`;
|
|
90805
|
-
var AUTH_TOKEN_KEY = "//npm.pkg.github.com/:_authToken";
|
|
90806
|
-
function mergeNpmrcEntries(existing, entries) {
|
|
90807
|
-
const keys = new Set(Object.keys(entries));
|
|
90808
|
-
const seenKeys = new Set;
|
|
90809
|
-
const lines = existing.split(`
|
|
90810
|
-
`);
|
|
90811
|
-
const out = [];
|
|
90812
|
-
for (const line of lines) {
|
|
90813
|
-
const stripped = line.trim();
|
|
90814
|
-
if (stripped === "" || stripped.startsWith(";") || stripped.startsWith("#")) {
|
|
90815
|
-
out.push(line);
|
|
90816
|
-
continue;
|
|
90817
|
-
}
|
|
90818
|
-
const eq = line.indexOf("=");
|
|
90819
|
-
if (eq < 0) {
|
|
90820
|
-
out.push(line);
|
|
90821
|
-
continue;
|
|
90822
|
-
}
|
|
90823
|
-
const key = line.slice(0, eq).trim();
|
|
90824
|
-
if (keys.has(key)) {
|
|
90825
|
-
seenKeys.add(key);
|
|
90826
|
-
out.push(`${key}=${entries[key]}`);
|
|
90827
|
-
} else {
|
|
90828
|
-
out.push(line);
|
|
90829
|
-
}
|
|
90830
|
-
}
|
|
90831
|
-
const additions = [];
|
|
90832
|
-
for (const key of keys) {
|
|
90833
|
-
if (!seenKeys.has(key)) {
|
|
90834
|
-
additions.push(`${key}=${entries[key]}`);
|
|
90835
|
-
}
|
|
90836
|
-
}
|
|
90837
|
-
let result = out.join(`
|
|
90838
|
-
`);
|
|
90839
|
-
if (additions.length > 0) {
|
|
90840
|
-
if (result.length > 0 && !result.endsWith(`
|
|
90841
|
-
`))
|
|
90842
|
-
result += `
|
|
90843
|
-
`;
|
|
90844
|
-
result += `${additions.join(`
|
|
90845
|
-
`)}
|
|
90846
|
-
`;
|
|
90847
|
-
} else if (result.length > 0 && !result.endsWith(`
|
|
90848
|
-
`)) {
|
|
90849
|
-
result += `
|
|
90850
|
-
`;
|
|
90851
|
-
}
|
|
90852
|
-
return result;
|
|
90853
|
-
}
|
|
90854
|
-
async function writeNpmrc(path8, entries, opts = {}) {
|
|
90855
|
-
let existing = "";
|
|
90856
|
-
let hadFile = false;
|
|
90857
|
-
try {
|
|
90858
|
-
existing = await fs10.readFile(path8, "utf8");
|
|
90859
|
-
hadFile = true;
|
|
90860
|
-
} catch (err) {
|
|
90861
|
-
if (err.code !== "ENOENT")
|
|
90862
|
-
throw err;
|
|
90863
|
-
}
|
|
90864
|
-
const merged = mergeNpmrcEntries(existing, entries);
|
|
90865
|
-
if (merged === existing) {
|
|
90866
|
-
return { written: false, backupPath: null, finalPath: path8, noChange: true };
|
|
90867
|
-
}
|
|
90868
|
-
let backupPath = null;
|
|
90869
|
-
if (hadFile) {
|
|
90870
|
-
const now = opts.now?.() ?? new Date;
|
|
90871
|
-
const stamp = now.toISOString().replace(/[:.]/g, "-");
|
|
90872
|
-
backupPath = `${path8}.bak.${stamp}`;
|
|
90873
|
-
await fs10.copyFile(path8, backupPath);
|
|
90874
|
-
}
|
|
90875
|
-
await fs10.mkdir(dirname29(path8), { recursive: true });
|
|
90876
|
-
const tmp = `${path8}.tmp.${process.pid}`;
|
|
90877
|
-
await fs10.writeFile(tmp, merged, { mode: 384 });
|
|
90878
|
-
await fs10.rename(tmp, path8);
|
|
90879
|
-
try {
|
|
90880
|
-
await fs10.chmod(path8, 384);
|
|
90881
|
-
} catch {}
|
|
90882
|
-
return { written: true, backupPath, finalPath: path8, noChange: false };
|
|
90883
|
-
}
|
|
90884
|
-
function buildGitHubPackagesEntries(pat) {
|
|
90885
|
-
const trimmed = pat.trim();
|
|
90886
|
-
return {
|
|
90887
|
-
[SCOPE_REGISTRY_KEY]: GITHUB_PACKAGES_REGISTRY_URL,
|
|
90888
|
-
[AUTH_TOKEN_KEY]: trimmed
|
|
90889
|
-
};
|
|
90890
|
-
}
|
|
90891
|
-
function isValidGitHubPat(value) {
|
|
90892
|
-
const v2 = value.trim();
|
|
90893
|
-
if (v2.length < 8)
|
|
90894
|
-
return false;
|
|
90895
|
-
if (/\s/.test(v2))
|
|
90896
|
-
return false;
|
|
90897
|
-
return /^(ghp_|github_pat_|ghs_|gho_|ghu_|ghr_)/.test(v2);
|
|
90898
|
-
}
|
|
90899
|
-
|
|
90900
|
-
// src/domains/health-checks/checkers/npmrc-github-packages-checker.ts
|
|
90901
|
-
init_environment();
|
|
90902
91041
|
var SETUP_HINT = "Run: ack fqc-qa-setup to write GitHub Packages config to ~/.npmrc";
|
|
90903
91042
|
var PROBE_PACKAGE = "@chiendt1108/fqc-mcp-servers";
|
|
90904
91043
|
var PROBE_TIMEOUT_MS = 5000;
|
|
@@ -92174,67 +92313,8 @@ function countFailures(states) {
|
|
|
92174
92313
|
// src/commands/fqc-qa/fqc-qa-setup-command.ts
|
|
92175
92314
|
init_logger();
|
|
92176
92315
|
init_dist2();
|
|
92316
|
+
init_npmrc_setup_step();
|
|
92177
92317
|
var import_picocolors20 = __toESM(require_picocolors(), 1);
|
|
92178
|
-
|
|
92179
|
-
// src/commands/fqc-qa/npmrc-setup-step.ts
|
|
92180
|
-
import { homedir as homedir45 } from "node:os";
|
|
92181
|
-
import { join as join96 } from "node:path";
|
|
92182
|
-
init_logger();
|
|
92183
|
-
init_dist2();
|
|
92184
|
-
var import_picocolors19 = __toESM(require_picocolors(), 1);
|
|
92185
|
-
async function runNpmrcSetupStep(opts = {}) {
|
|
92186
|
-
if (process.env.FQC_QA_SKIP_NPMRC === "1") {
|
|
92187
|
-
logger.info(import_picocolors19.default.dim("Skipping ~/.npmrc bootstrap (FQC_QA_SKIP_NPMRC=1)"));
|
|
92188
|
-
return { status: "skipped-env" };
|
|
92189
|
-
}
|
|
92190
|
-
console.log("");
|
|
92191
|
-
le([
|
|
92192
|
-
"To resolve @chiendt1108/fqc-mcp-servers from GitHub Packages, ~/.npmrc",
|
|
92193
|
-
"needs a scope mapping and a GitHub PAT with the `read:packages` scope.",
|
|
92194
|
-
"Create one at: https://github.com/settings/tokens (classic) or",
|
|
92195
|
-
"https://github.com/settings/personal-access-tokens/new (fine-grained).",
|
|
92196
|
-
"",
|
|
92197
|
-
"Press Enter / Esc to skip — rerun later with `ack fqc-qa-setup --npmrc-only`."
|
|
92198
|
-
].join(`
|
|
92199
|
-
`), "GitHub Packages auth");
|
|
92200
|
-
if (opts.yes) {
|
|
92201
|
-
logger.info(import_picocolors19.default.yellow("--yes given — skipping interactive PAT prompt."));
|
|
92202
|
-
return { status: "skipped-cancel" };
|
|
92203
|
-
}
|
|
92204
|
-
const pat = await re({
|
|
92205
|
-
message: "GitHub Personal Access Token (read:packages):",
|
|
92206
|
-
validate: (value) => {
|
|
92207
|
-
if (!value)
|
|
92208
|
-
return;
|
|
92209
|
-
if (!isValidGitHubPat(value)) {
|
|
92210
|
-
return "Token must start with ghp_, github_pat_, ghs_, gho_, ghu_, or ghr_.";
|
|
92211
|
-
}
|
|
92212
|
-
return;
|
|
92213
|
-
}
|
|
92214
|
-
});
|
|
92215
|
-
if (lD(pat) || !pat) {
|
|
92216
|
-
logger.info(import_picocolors19.default.yellow("Skipped PAT entry. Rerun with `ack fqc-qa-setup --npmrc-only` when ready."));
|
|
92217
|
-
return { status: "skipped-cancel" };
|
|
92218
|
-
}
|
|
92219
|
-
const npmrcPath = join96(homedir45(), ".npmrc");
|
|
92220
|
-
try {
|
|
92221
|
-
const result = await writeNpmrc(npmrcPath, buildGitHubPackagesEntries(pat));
|
|
92222
|
-
if (result.noChange) {
|
|
92223
|
-
logger.info(import_picocolors19.default.dim("~/.npmrc already up to date"));
|
|
92224
|
-
return { status: "no-change" };
|
|
92225
|
-
}
|
|
92226
|
-
logger.info(import_picocolors19.default.green(`Wrote GitHub Packages config → ${npmrcPath}`));
|
|
92227
|
-
if (result.backupPath)
|
|
92228
|
-
logger.info(import_picocolors19.default.dim(` backup: ${result.backupPath}`));
|
|
92229
|
-
return { status: "written", backupPath: result.backupPath };
|
|
92230
|
-
} catch (err) {
|
|
92231
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
92232
|
-
logger.error(`Failed to write ~/.npmrc: ${msg}`);
|
|
92233
|
-
return { status: "error", error: msg };
|
|
92234
|
-
}
|
|
92235
|
-
}
|
|
92236
|
-
|
|
92237
|
-
// src/commands/fqc-qa/fqc-qa-setup-command.ts
|
|
92238
92318
|
async function fqcQaSetupCommand(opts) {
|
|
92239
92319
|
if (opts.npmrcOnly) {
|
|
92240
92320
|
await runNpmrcSetupStep({ yes: opts.yes });
|
|
@@ -98939,10 +99019,10 @@ class TarExtractor {
|
|
|
98939
99019
|
// src/domains/installation/extraction/zip-extractor.ts
|
|
98940
99020
|
init_logger();
|
|
98941
99021
|
var import_extract_zip = __toESM(require_extract_zip(), 1);
|
|
98942
|
-
import { execFile as
|
|
99022
|
+
import { execFile as execFile11 } from "node:child_process";
|
|
98943
99023
|
import { copyFile as copyFile6, mkdir as mkdir29, readdir as readdir26, rm as rm14, stat as stat16 } from "node:fs/promises";
|
|
98944
99024
|
import { join as join111 } from "node:path";
|
|
98945
|
-
import { promisify as
|
|
99025
|
+
import { promisify as promisify13 } from "node:util";
|
|
98946
99026
|
|
|
98947
99027
|
// src/domains/installation/extraction/native-zip-commands.ts
|
|
98948
99028
|
var NATIVE_EXTRACT_TIMEOUT_MS = 120000;
|
|
@@ -98981,7 +99061,7 @@ function getNativeZipCommands(archivePath, destDir, platformName = process.platf
|
|
|
98981
99061
|
}
|
|
98982
99062
|
|
|
98983
99063
|
// src/domains/installation/extraction/zip-extractor.ts
|
|
98984
|
-
var execFileAsync7 =
|
|
99064
|
+
var execFileAsync7 = promisify13(execFile11);
|
|
98985
99065
|
|
|
98986
99066
|
class ZipExtractor {
|
|
98987
99067
|
async tryNativeExtraction(archivePath, destDir) {
|
|
@@ -99632,7 +99712,7 @@ async function handleDownload(ctx) {
|
|
|
99632
99712
|
import { join as join129 } from "node:path";
|
|
99633
99713
|
|
|
99634
99714
|
// src/domains/installation/deletion-handler.ts
|
|
99635
|
-
import { existsSync as
|
|
99715
|
+
import { existsSync as existsSync71, lstatSync as lstatSync3, readdirSync as readdirSync8, rmSync as rmSync2, rmdirSync, unlinkSync as unlinkSync5 } from "node:fs";
|
|
99636
99716
|
import { dirname as dirname36, join as join115, relative as relative22, resolve as resolve41, sep as sep11 } from "node:path";
|
|
99637
99717
|
|
|
99638
99718
|
// src/services/file-operations/manifest/manifest-reader.ts
|
|
@@ -99823,7 +99903,7 @@ function shouldDeletePath(path10, metadata, kitType) {
|
|
|
99823
99903
|
}
|
|
99824
99904
|
function collectFilesRecursively(dir, baseDir) {
|
|
99825
99905
|
const results = [];
|
|
99826
|
-
if (!
|
|
99906
|
+
if (!existsSync71(dir))
|
|
99827
99907
|
return results;
|
|
99828
99908
|
try {
|
|
99829
99909
|
const entries = readdirSync8(dir, { withFileTypes: true });
|
|
@@ -99964,7 +100044,7 @@ async function handleDeletions(sourceMetadata, claudeDir3, kitType) {
|
|
|
99964
100044
|
logger.verbose(`Preserved user file: ${path10}`);
|
|
99965
100045
|
continue;
|
|
99966
100046
|
}
|
|
99967
|
-
if (
|
|
100047
|
+
if (existsSync71(fullPath)) {
|
|
99968
100048
|
try {
|
|
99969
100049
|
deletePath(fullPath, claudeDir3);
|
|
99970
100050
|
result.deletedPaths.push(path10);
|
|
@@ -101911,7 +101991,7 @@ import { dirname as dirname38, join as join118 } from "node:path";
|
|
|
101911
101991
|
|
|
101912
101992
|
// src/domains/config/installed-settings-tracker.ts
|
|
101913
101993
|
init_shared();
|
|
101914
|
-
import { existsSync as
|
|
101994
|
+
import { existsSync as existsSync72 } from "node:fs";
|
|
101915
101995
|
import { mkdir as mkdir31, readFile as readFile53, writeFile as writeFile27 } from "node:fs/promises";
|
|
101916
101996
|
import { dirname as dirname37, join as join117 } from "node:path";
|
|
101917
101997
|
var CK_JSON_FILE = ".ck.json";
|
|
@@ -101933,7 +102013,7 @@ class InstalledSettingsTracker {
|
|
|
101933
102013
|
}
|
|
101934
102014
|
async loadInstalledSettings() {
|
|
101935
102015
|
const ckJsonPath = this.getCkJsonPath();
|
|
101936
|
-
if (!
|
|
102016
|
+
if (!existsSync72(ckJsonPath)) {
|
|
101937
102017
|
return { hooks: [], mcpServers: [] };
|
|
101938
102018
|
}
|
|
101939
102019
|
try {
|
|
@@ -101953,7 +102033,7 @@ class InstalledSettingsTracker {
|
|
|
101953
102033
|
const ckJsonPath = this.getCkJsonPath();
|
|
101954
102034
|
try {
|
|
101955
102035
|
let data = {};
|
|
101956
|
-
if (
|
|
102036
|
+
if (existsSync72(ckJsonPath)) {
|
|
101957
102037
|
const content = await readFile53(ckJsonPath, "utf-8");
|
|
101958
102038
|
data = JSON.parse(content);
|
|
101959
102039
|
}
|
|
@@ -105609,6 +105689,10 @@ async function handlePostInstall(ctx) {
|
|
|
105609
105689
|
withSudo: ctx.options.withSudo
|
|
105610
105690
|
});
|
|
105611
105691
|
}
|
|
105692
|
+
if (ctx.kitType === "fqc-qa") {
|
|
105693
|
+
const { runNpmrcSetupStep: runNpmrcSetupStep2 } = await Promise.resolve().then(() => (init_npmrc_setup_step(), exports_npmrc_setup_step));
|
|
105694
|
+
await runNpmrcSetupStep2({ yes: ctx.isNonInteractive });
|
|
105695
|
+
}
|
|
105612
105696
|
if (!ctx.isNonInteractive) {
|
|
105613
105697
|
const { isGeminiInstalled: isGeminiInstalled2 } = await Promise.resolve().then(() => (init_package_installer(), exports_package_installer));
|
|
105614
105698
|
const { checkExistingGeminiConfig: checkExistingGeminiConfig2, findMcpConfigPath: findMcpConfigPath2, processGeminiMcpLinking: processGeminiMcpLinking2 } = await Promise.resolve().then(() => (init_gemini_mcp_linker(), exports_gemini_mcp_linker));
|
|
@@ -105730,8 +105814,8 @@ async function detectAccessibleKits() {
|
|
|
105730
105814
|
// src/domains/github/preflight-checker.ts
|
|
105731
105815
|
init_logger();
|
|
105732
105816
|
import { exec as exec5 } from "node:child_process";
|
|
105733
|
-
import { promisify as
|
|
105734
|
-
var execAsync5 =
|
|
105817
|
+
import { promisify as promisify14 } from "node:util";
|
|
105818
|
+
var execAsync5 = promisify14(exec5);
|
|
105735
105819
|
function createSuccessfulPreflightResult() {
|
|
105736
105820
|
return {
|
|
105737
105821
|
success: true,
|
|
@@ -105828,7 +105912,7 @@ async function runPreflightChecks() {
|
|
|
105828
105912
|
|
|
105829
105913
|
// src/domains/installation/fresh-installer.ts
|
|
105830
105914
|
init_metadata_migration();
|
|
105831
|
-
import { existsSync as
|
|
105915
|
+
import { existsSync as existsSync73, readdirSync as readdirSync9, rmSync as rmSync3, rmdirSync as rmdirSync2, unlinkSync as unlinkSync6 } from "node:fs";
|
|
105832
105916
|
import { basename as basename28, dirname as dirname40, join as join141, resolve as resolve45 } from "node:path";
|
|
105833
105917
|
init_logger();
|
|
105834
105918
|
init_safe_spinner();
|
|
@@ -105912,7 +105996,7 @@ async function removeFilesByOwnership(claudeDir3, analysis, includeModified) {
|
|
|
105912
105996
|
}
|
|
105913
105997
|
for (const file of filesToRemove) {
|
|
105914
105998
|
const fullPath = join141(claudeDir3, file.path);
|
|
105915
|
-
if (!
|
|
105999
|
+
if (!existsSync73(fullPath)) {
|
|
105916
106000
|
continue;
|
|
105917
106001
|
}
|
|
105918
106002
|
try {
|
|
@@ -105970,8 +106054,8 @@ function getFreshBackupTargets(claudeDir3, analysis, includeModified) {
|
|
|
105970
106054
|
mutatePaths: filesToRemove.length > 0 ? ["metadata.json"] : []
|
|
105971
106055
|
};
|
|
105972
106056
|
}
|
|
105973
|
-
const deletePaths = ACK_SUBDIRECTORIES.filter((subdir) =>
|
|
105974
|
-
if (
|
|
106057
|
+
const deletePaths = ACK_SUBDIRECTORIES.filter((subdir) => existsSync73(join141(claudeDir3, subdir)));
|
|
106058
|
+
if (existsSync73(join141(claudeDir3, "metadata.json"))) {
|
|
105975
106059
|
deletePaths.push("metadata.json");
|
|
105976
106060
|
}
|
|
105977
106061
|
return {
|
|
@@ -107660,7 +107744,7 @@ async function initCommand(options2) {
|
|
|
107660
107744
|
// src/commands/migrate/migrate-command.ts
|
|
107661
107745
|
init_dist2();
|
|
107662
107746
|
var import_picocolors35 = __toESM(require_picocolors(), 1);
|
|
107663
|
-
import { existsSync as
|
|
107747
|
+
import { existsSync as existsSync74 } from "node:fs";
|
|
107664
107748
|
import { readFile as readFile68, rm as rm20, unlink as unlink15 } from "node:fs/promises";
|
|
107665
107749
|
import { homedir as homedir54 } from "node:os";
|
|
107666
107750
|
import { basename as basename30, join as join152, resolve as resolve50 } from "node:path";
|
|
@@ -109303,7 +109387,7 @@ async function executeDeleteAction(action, options2) {
|
|
|
109303
109387
|
const preservePaths = options2?.preservePaths ?? new Set;
|
|
109304
109388
|
const shouldPreserveTarget = action.targetPath.length > 0 && preservePaths.has(resolve50(action.targetPath));
|
|
109305
109389
|
try {
|
|
109306
|
-
if (!shouldPreserveTarget && action.targetPath &&
|
|
109390
|
+
if (!shouldPreserveTarget && action.targetPath && existsSync74(action.targetPath)) {
|
|
109307
109391
|
await rm20(action.targetPath, { recursive: true, force: true });
|
|
109308
109392
|
}
|
|
109309
109393
|
await removePortableInstallation(action.item, action.type, action.provider, action.global, action.targetPath ? { path: action.targetPath } : undefined);
|
|
@@ -109335,7 +109419,7 @@ async function processMetadataDeletions(skillSourcePath, installGlobally) {
|
|
|
109335
109419
|
if (!skillSourcePath)
|
|
109336
109420
|
return;
|
|
109337
109421
|
const sourceMetadataPath = join152(resolve50(skillSourcePath, ".."), "metadata.json");
|
|
109338
|
-
if (!
|
|
109422
|
+
if (!existsSync74(sourceMetadataPath))
|
|
109339
109423
|
return;
|
|
109340
109424
|
let sourceMetadata;
|
|
109341
109425
|
try {
|
|
@@ -109348,7 +109432,7 @@ async function processMetadataDeletions(skillSourcePath, installGlobally) {
|
|
|
109348
109432
|
if (!sourceMetadata.deletions || sourceMetadata.deletions.length === 0)
|
|
109349
109433
|
return;
|
|
109350
109434
|
const claudeDir3 = installGlobally ? join152(homedir54(), ".claude") : join152(process.cwd(), ".claude");
|
|
109351
|
-
if (!
|
|
109435
|
+
if (!existsSync74(claudeDir3))
|
|
109352
109436
|
return;
|
|
109353
109437
|
try {
|
|
109354
109438
|
const result = await handleDeletions(sourceMetadata, claudeDir3, inferKitTypeFromSourceMetadata(sourceMetadata));
|
|
@@ -109640,7 +109724,7 @@ async function migrateCommand(options2) {
|
|
|
109640
109724
|
const interactive = process.stdout.isTTY && !options2.yes;
|
|
109641
109725
|
const conflictActions = plan.actions.filter((a3) => a3.action === "conflict");
|
|
109642
109726
|
for (const action of conflictActions) {
|
|
109643
|
-
if (!action.diff && action.targetPath &&
|
|
109727
|
+
if (!action.diff && action.targetPath && existsSync74(action.targetPath)) {
|
|
109644
109728
|
try {
|
|
109645
109729
|
const targetContent = await readFile68(action.targetPath, "utf-8");
|
|
109646
109730
|
const sourceItem = effectiveAgents.find((a3) => a3.name === action.item) || effectiveCommands.find((c2) => c2.name === action.item) || (effectiveConfigItem?.name === action.item ? effectiveConfigItem : null) || effectiveRuleItems.find((r2) => r2.name === action.item) || effectiveHookItems.find((h2) => h2.name === action.item);
|
|
@@ -109956,7 +110040,7 @@ async function migrateCommand(options2) {
|
|
|
109956
110040
|
async function rollbackResults(results) {
|
|
109957
110041
|
const rolledBackPaths = new Set;
|
|
109958
110042
|
for (const result of results) {
|
|
109959
|
-
if (!result.path || !
|
|
110043
|
+
if (!result.path || !existsSync74(result.path))
|
|
109960
110044
|
continue;
|
|
109961
110045
|
try {
|
|
109962
110046
|
if (result.overwritten)
|
|
@@ -110452,6 +110536,10 @@ async function postSetup(resolvedDir, validOptions, isNonInteractive2, prompts)
|
|
|
110452
110536
|
withSudo: validOptions.withSudo
|
|
110453
110537
|
});
|
|
110454
110538
|
}
|
|
110539
|
+
if (validOptions.kit === "fqc-qa") {
|
|
110540
|
+
const { runNpmrcSetupStep: runNpmrcSetupStep2 } = await Promise.resolve().then(() => (init_npmrc_setup_step(), exports_npmrc_setup_step));
|
|
110541
|
+
await runNpmrcSetupStep2({ yes: isNonInteractive2 });
|
|
110542
|
+
}
|
|
110455
110543
|
const claudeDir3 = join154(resolvedDir, ".claude");
|
|
110456
110544
|
await promptSetupWizardIfNeeded({
|
|
110457
110545
|
envPath: join154(claudeDir3, ".env"),
|
|
@@ -110523,7 +110611,7 @@ Please use only one download method.`);
|
|
|
110523
110611
|
}
|
|
110524
110612
|
// src/commands/plan/plan-command.ts
|
|
110525
110613
|
init_output_manager();
|
|
110526
|
-
import { existsSync as
|
|
110614
|
+
import { existsSync as existsSync77, statSync as statSync13 } from "node:fs";
|
|
110527
110615
|
import { dirname as dirname48, isAbsolute as isAbsolute13, join as join157, parse as parse3, resolve as resolve55 } from "node:path";
|
|
110528
110616
|
|
|
110529
110617
|
// src/commands/plan/plan-read-handlers.ts
|
|
@@ -110533,14 +110621,14 @@ init_plans_registry();
|
|
|
110533
110621
|
init_logger();
|
|
110534
110622
|
init_output_manager();
|
|
110535
110623
|
var import_picocolors37 = __toESM(require_picocolors(), 1);
|
|
110536
|
-
import { existsSync as
|
|
110624
|
+
import { existsSync as existsSync76, statSync as statSync12 } from "node:fs";
|
|
110537
110625
|
import { basename as basename31, dirname as dirname46, join as join156, relative as relative32, resolve as resolve53 } from "node:path";
|
|
110538
110626
|
|
|
110539
110627
|
// src/commands/plan/plan-dependencies.ts
|
|
110540
110628
|
init_config();
|
|
110541
110629
|
init_plan_parser();
|
|
110542
110630
|
init_plans_registry();
|
|
110543
|
-
import { existsSync as
|
|
110631
|
+
import { existsSync as existsSync75 } from "node:fs";
|
|
110544
110632
|
import { dirname as dirname45, join as join155 } from "node:path";
|
|
110545
110633
|
async function resolvePlanDependencies(references, currentPlanFile, options2 = {}) {
|
|
110546
110634
|
if (references.length === 0)
|
|
@@ -110563,7 +110651,7 @@ async function resolvePlanDependencies(references, currentPlanFile, options2 = {
|
|
|
110563
110651
|
const scopeRoot = resolvePlanDirForScope(scope, projectRoot, config);
|
|
110564
110652
|
const planFile = join155(scopeRoot, planId, "plan.md");
|
|
110565
110653
|
const isSelfReference = planFile === currentPlanFile;
|
|
110566
|
-
if (!
|
|
110654
|
+
if (!existsSync75(planFile)) {
|
|
110567
110655
|
return {
|
|
110568
110656
|
reference,
|
|
110569
110657
|
scope,
|
|
@@ -110703,7 +110791,7 @@ async function handleStatus(target, options2) {
|
|
|
110703
110791
|
}
|
|
110704
110792
|
const effectiveTarget = !resolvedTarget && globalBaseDir ? globalBaseDir : resolvedTarget;
|
|
110705
110793
|
const t = effectiveTarget ? resolve53(effectiveTarget) : null;
|
|
110706
|
-
const plansDir = t &&
|
|
110794
|
+
const plansDir = t && existsSync76(t) && statSync12(t).isDirectory() && !existsSync76(join156(t, "plan.md")) ? t : null;
|
|
110707
110795
|
if (plansDir) {
|
|
110708
110796
|
const planFiles = scanPlanDir(plansDir);
|
|
110709
110797
|
if (planFiles.length === 0) {
|
|
@@ -111107,19 +111195,19 @@ function resolveTargetPath(target, baseDir) {
|
|
|
111107
111195
|
return resolve55(target);
|
|
111108
111196
|
}
|
|
111109
111197
|
const cwdCandidate = resolve55(target);
|
|
111110
|
-
if (
|
|
111198
|
+
if (existsSync77(cwdCandidate)) {
|
|
111111
111199
|
return cwdCandidate;
|
|
111112
111200
|
}
|
|
111113
111201
|
return resolve55(baseDir, target);
|
|
111114
111202
|
}
|
|
111115
111203
|
function resolvePlanFile(target, baseDir) {
|
|
111116
111204
|
const t = target ? resolveTargetPath(target, baseDir) : baseDir ? resolve55(baseDir) : process.cwd();
|
|
111117
|
-
if (
|
|
111205
|
+
if (existsSync77(t)) {
|
|
111118
111206
|
const stat24 = statSync13(t);
|
|
111119
111207
|
if (stat24.isFile())
|
|
111120
111208
|
return t;
|
|
111121
111209
|
const candidate = join157(t, "plan.md");
|
|
111122
|
-
if (
|
|
111210
|
+
if (existsSync77(candidate))
|
|
111123
111211
|
return candidate;
|
|
111124
111212
|
}
|
|
111125
111213
|
if (!target && !baseDir) {
|
|
@@ -111127,7 +111215,7 @@ function resolvePlanFile(target, baseDir) {
|
|
|
111127
111215
|
const root = parse3(dir).root;
|
|
111128
111216
|
while (dir !== root) {
|
|
111129
111217
|
const candidate = join157(dir, "plan.md");
|
|
111130
|
-
if (
|
|
111218
|
+
if (existsSync77(candidate))
|
|
111131
111219
|
return candidate;
|
|
111132
111220
|
dir = dirname48(dir);
|
|
111133
111221
|
}
|
|
@@ -111177,7 +111265,7 @@ async function planCommand(action, target, options2) {
|
|
|
111177
111265
|
let resolvedTarget = target;
|
|
111178
111266
|
if (resolvedAction && !knownActions.has(resolvedAction)) {
|
|
111179
111267
|
const looksLikePath = resolvedAction.includes("/") || resolvedAction.includes("\\") || resolvedAction.endsWith(".md") || resolvedAction === "." || resolvedAction === "..";
|
|
111180
|
-
const existsOnDisk = !looksLikePath &&
|
|
111268
|
+
const existsOnDisk = !looksLikePath && existsSync77(resolve55(resolvedAction));
|
|
111181
111269
|
if (looksLikePath || existsOnDisk) {
|
|
111182
111270
|
resolvedTarget = resolvedAction;
|
|
111183
111271
|
resolvedAction = undefined;
|
|
@@ -111219,13 +111307,13 @@ init_ack_data2();
|
|
|
111219
111307
|
init_logger();
|
|
111220
111308
|
init_safe_prompts();
|
|
111221
111309
|
var import_picocolors39 = __toESM(require_picocolors(), 1);
|
|
111222
|
-
import { existsSync as
|
|
111310
|
+
import { existsSync as existsSync78 } from "node:fs";
|
|
111223
111311
|
import { resolve as resolve56 } from "node:path";
|
|
111224
111312
|
async function handleAdd(projectPath, options2) {
|
|
111225
111313
|
logger.debug(`Adding project: ${projectPath}, options: ${JSON.stringify(options2)}`);
|
|
111226
111314
|
intro("Add Project");
|
|
111227
111315
|
const absolutePath = resolve56(projectPath);
|
|
111228
|
-
if (!
|
|
111316
|
+
if (!existsSync78(absolutePath)) {
|
|
111229
111317
|
log.error(`Path does not exist: ${absolutePath}`);
|
|
111230
111318
|
process.exitCode = 1;
|
|
111231
111319
|
return;
|
|
@@ -113080,7 +113168,7 @@ ${import_picocolors45.default.bold(import_picocolors45.default.cyan(result.kitCo
|
|
|
113080
113168
|
|
|
113081
113169
|
// src/commands/watch/watch-command.ts
|
|
113082
113170
|
init_logger();
|
|
113083
|
-
import { existsSync as
|
|
113171
|
+
import { existsSync as existsSync84 } from "node:fs";
|
|
113084
113172
|
import { rm as rm21 } from "node:fs/promises";
|
|
113085
113173
|
import { join as join168 } from "node:path";
|
|
113086
113174
|
var import_picocolors46 = __toESM(require_picocolors(), 1);
|
|
@@ -114379,14 +114467,14 @@ function cleanExpiredIssues(state, ttlDays) {
|
|
|
114379
114467
|
init_ck_config_manager();
|
|
114380
114468
|
init_file_io();
|
|
114381
114469
|
init_logger();
|
|
114382
|
-
import { existsSync as
|
|
114470
|
+
import { existsSync as existsSync80 } from "node:fs";
|
|
114383
114471
|
import { mkdir as mkdir41, readFile as readFile71 } from "node:fs/promises";
|
|
114384
114472
|
import { dirname as dirname50 } from "node:path";
|
|
114385
114473
|
var PROCESSED_ISSUES_CAP = 500;
|
|
114386
114474
|
async function readCkJson(projectDir) {
|
|
114387
114475
|
const configPath = CkConfigManager.getProjectConfigPath(projectDir);
|
|
114388
114476
|
try {
|
|
114389
|
-
if (!
|
|
114477
|
+
if (!existsSync80(configPath))
|
|
114390
114478
|
return {};
|
|
114391
114479
|
const content = await readFile71(configPath, "utf-8");
|
|
114392
114480
|
return JSON.parse(content);
|
|
@@ -114412,7 +114500,7 @@ async function loadWatchState(projectDir) {
|
|
|
114412
114500
|
async function saveWatchState(projectDir, state) {
|
|
114413
114501
|
const configPath = CkConfigManager.getProjectConfigPath(projectDir);
|
|
114414
114502
|
const configDir = dirname50(configPath);
|
|
114415
|
-
if (!
|
|
114503
|
+
if (!existsSync80(configDir)) {
|
|
114416
114504
|
await mkdir41(configDir, { recursive: true });
|
|
114417
114505
|
}
|
|
114418
114506
|
const raw = await readCkJson(projectDir);
|
|
@@ -114539,7 +114627,7 @@ async function processImplementationQueue(state, config, setup, options2, watchL
|
|
|
114539
114627
|
// src/commands/watch/phases/repo-scanner.ts
|
|
114540
114628
|
init_logger();
|
|
114541
114629
|
import { spawnSync as spawnSync7 } from "node:child_process";
|
|
114542
|
-
import { existsSync as
|
|
114630
|
+
import { existsSync as existsSync81 } from "node:fs";
|
|
114543
114631
|
import { readdir as readdir47, stat as stat25 } from "node:fs/promises";
|
|
114544
114632
|
import { join as join165 } from "node:path";
|
|
114545
114633
|
async function scanForRepos(parentDir) {
|
|
@@ -114553,7 +114641,7 @@ async function scanForRepos(parentDir) {
|
|
|
114553
114641
|
if (!entryStat.isDirectory())
|
|
114554
114642
|
continue;
|
|
114555
114643
|
const gitDir = join165(fullPath, ".git");
|
|
114556
|
-
if (!
|
|
114644
|
+
if (!existsSync81(gitDir))
|
|
114557
114645
|
continue;
|
|
114558
114646
|
const result = spawnSync7("gh", ["repo", "view", "--json", "owner,name"], {
|
|
114559
114647
|
encoding: "utf-8",
|
|
@@ -114577,7 +114665,7 @@ async function scanForRepos(parentDir) {
|
|
|
114577
114665
|
// src/commands/watch/phases/setup-validator.ts
|
|
114578
114666
|
init_logger();
|
|
114579
114667
|
import { spawnSync as spawnSync8 } from "node:child_process";
|
|
114580
|
-
import { existsSync as
|
|
114668
|
+
import { existsSync as existsSync82 } from "node:fs";
|
|
114581
114669
|
import { homedir as homedir55 } from "node:os";
|
|
114582
114670
|
import { join as join166 } from "node:path";
|
|
114583
114671
|
async function validateSetup(cwd2) {
|
|
@@ -114611,7 +114699,7 @@ Run this command from a directory with a GitHub remote.`);
|
|
|
114611
114699
|
throw new Error(`Failed to parse repository info: ${ghRepo.stdout}`);
|
|
114612
114700
|
}
|
|
114613
114701
|
const skillsPath = join166(homedir55(), ".claude", "skills");
|
|
114614
|
-
const skillsAvailable =
|
|
114702
|
+
const skillsAvailable = existsSync82(skillsPath);
|
|
114615
114703
|
if (!skillsAvailable) {
|
|
114616
114704
|
logger.warning(`AckKit Engineer skills not found at ${skillsPath}`);
|
|
114617
114705
|
}
|
|
@@ -114627,7 +114715,7 @@ Run this command from a directory with a GitHub remote.`);
|
|
|
114627
114715
|
init_logger();
|
|
114628
114716
|
init_path_resolver();
|
|
114629
114717
|
import { createWriteStream as createWriteStream3, statSync as statSync14 } from "node:fs";
|
|
114630
|
-
import { existsSync as
|
|
114718
|
+
import { existsSync as existsSync83 } from "node:fs";
|
|
114631
114719
|
import { mkdir as mkdir42, rename as rename16 } from "node:fs/promises";
|
|
114632
114720
|
import { join as join167 } from "node:path";
|
|
114633
114721
|
|
|
@@ -114642,7 +114730,7 @@ class WatchLogger {
|
|
|
114642
114730
|
}
|
|
114643
114731
|
async init() {
|
|
114644
114732
|
try {
|
|
114645
|
-
if (!
|
|
114733
|
+
if (!existsSync83(this.logDir)) {
|
|
114646
114734
|
await mkdir42(this.logDir, { recursive: true });
|
|
114647
114735
|
}
|
|
114648
114736
|
const dateStr = formatDate(new Date);
|
|
@@ -114828,7 +114916,7 @@ async function watchCommand(options2) {
|
|
|
114828
114916
|
}
|
|
114829
114917
|
async function discoverRepos(options2, watchLog) {
|
|
114830
114918
|
const cwd2 = process.cwd();
|
|
114831
|
-
const isGitRepo =
|
|
114919
|
+
const isGitRepo = existsSync84(join168(cwd2, ".git"));
|
|
114832
114920
|
if (options2.force) {
|
|
114833
114921
|
await forceRemoveLock(watchLog);
|
|
114834
114922
|
}
|
|
@@ -115131,7 +115219,7 @@ init_logger();
|
|
|
115131
115219
|
init_path_resolver();
|
|
115132
115220
|
init_types3();
|
|
115133
115221
|
init_types3();
|
|
115134
|
-
import { existsSync as
|
|
115222
|
+
import { existsSync as existsSync95, readFileSync as readFileSync26 } from "node:fs";
|
|
115135
115223
|
import { join as join179 } from "node:path";
|
|
115136
115224
|
var packageVersion2 = package_default.version;
|
|
115137
115225
|
function formatInstalledKits(metadata) {
|
|
@@ -115201,9 +115289,9 @@ async function displayVersion() {
|
|
|
115201
115289
|
const prefix = PathResolver.getPathPrefix(false);
|
|
115202
115290
|
const localMetadataPath = prefix ? join179(process.cwd(), prefix, "metadata.json") : join179(process.cwd(), "metadata.json");
|
|
115203
115291
|
const isLocalSameAsGlobal = localMetadataPath === globalMetadataPath;
|
|
115204
|
-
if (!isLocalSameAsGlobal &&
|
|
115292
|
+
if (!isLocalSameAsGlobal && existsSync95(localMetadataPath)) {
|
|
115205
115293
|
try {
|
|
115206
|
-
const rawMetadata = JSON.parse(
|
|
115294
|
+
const rawMetadata = JSON.parse(readFileSync26(localMetadataPath, "utf-8"));
|
|
115207
115295
|
const metadata = MetadataSchema.parse(rawMetadata);
|
|
115208
115296
|
const kitsDisplay = formatInstalledKits(metadata);
|
|
115209
115297
|
if (kitsDisplay) {
|
|
@@ -115215,9 +115303,9 @@ async function displayVersion() {
|
|
|
115215
115303
|
logger.verbose("Failed to parse local metadata.json", { error });
|
|
115216
115304
|
}
|
|
115217
115305
|
}
|
|
115218
|
-
if (
|
|
115306
|
+
if (existsSync95(globalMetadataPath)) {
|
|
115219
115307
|
try {
|
|
115220
|
-
const rawMetadata = JSON.parse(
|
|
115308
|
+
const rawMetadata = JSON.parse(readFileSync26(globalMetadataPath, "utf-8"));
|
|
115221
115309
|
const metadata = MetadataSchema.parse(rawMetadata);
|
|
115222
115310
|
const kitsDisplay = formatInstalledKits(metadata);
|
|
115223
115311
|
if (kitsDisplay) {
|