prjct-cli 0.41.0 → 0.42.0
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/CHANGELOG.md +37 -0
- package/bin/prjct.ts +26 -0
- package/core/cli/linear.ts +381 -0
- package/core/utils/project-credentials.ts +148 -0
- package/dist/bin/prjct.mjs +19 -1
- package/dist/core/infrastructure/setup.js +238 -192
- package/package.json +1 -1
- package/templates/commands/enrich.md +152 -18
- package/templates/commands/linear.md +169 -135
|
@@ -115,7 +115,7 @@ function hasProviderConfig(provider) {
|
|
|
115
115
|
if (!config.configDir) {
|
|
116
116
|
return false;
|
|
117
117
|
}
|
|
118
|
-
return
|
|
118
|
+
return import_fs2.default.existsSync(config.configDir);
|
|
119
119
|
}
|
|
120
120
|
function getProviderBranding(provider) {
|
|
121
121
|
const config = Providers[provider];
|
|
@@ -154,11 +154,11 @@ Designed for [Claude](${config.websiteUrl})`,
|
|
|
154
154
|
};
|
|
155
155
|
}
|
|
156
156
|
function detectCursorProject(projectRoot) {
|
|
157
|
-
const cursorDir =
|
|
158
|
-
const rulesDir =
|
|
159
|
-
const routerPath =
|
|
160
|
-
const detected =
|
|
161
|
-
const routerInstalled =
|
|
157
|
+
const cursorDir = import_path2.default.join(projectRoot, ".cursor");
|
|
158
|
+
const rulesDir = import_path2.default.join(cursorDir, "rules");
|
|
159
|
+
const routerPath = import_path2.default.join(rulesDir, "prjct.mdc");
|
|
160
|
+
const detected = import_fs2.default.existsSync(cursorDir);
|
|
161
|
+
const routerInstalled = import_fs2.default.existsSync(routerPath);
|
|
162
162
|
return {
|
|
163
163
|
detected,
|
|
164
164
|
routerInstalled,
|
|
@@ -170,11 +170,11 @@ function needsCursorRouterRegeneration(projectRoot) {
|
|
|
170
170
|
return detection.detected && !detection.routerInstalled;
|
|
171
171
|
}
|
|
172
172
|
function detectWindsurfProject(projectRoot) {
|
|
173
|
-
const windsurfDir =
|
|
174
|
-
const rulesDir =
|
|
175
|
-
const routerPath =
|
|
176
|
-
const detected =
|
|
177
|
-
const routerInstalled =
|
|
173
|
+
const windsurfDir = import_path2.default.join(projectRoot, ".windsurf");
|
|
174
|
+
const rulesDir = import_path2.default.join(windsurfDir, "rules");
|
|
175
|
+
const routerPath = import_path2.default.join(rulesDir, "prjct.md");
|
|
176
|
+
const detected = import_fs2.default.existsSync(windsurfDir);
|
|
177
|
+
const routerInstalled = import_fs2.default.existsSync(routerPath);
|
|
178
178
|
return {
|
|
179
179
|
detected,
|
|
180
180
|
routerInstalled,
|
|
@@ -190,9 +190,9 @@ function detectAntigravity() {
|
|
|
190
190
|
if (!configPath) {
|
|
191
191
|
return { installed: false, skillInstalled: false };
|
|
192
192
|
}
|
|
193
|
-
const installed =
|
|
194
|
-
const skillPath =
|
|
195
|
-
const skillInstalled =
|
|
193
|
+
const installed = import_fs2.default.existsSync(configPath);
|
|
194
|
+
const skillPath = import_path2.default.join(configPath, "skills", "prjct", "SKILL.md");
|
|
195
|
+
const skillInstalled = import_fs2.default.existsSync(skillPath);
|
|
196
196
|
return {
|
|
197
197
|
installed,
|
|
198
198
|
skillInstalled,
|
|
@@ -204,14 +204,14 @@ function getGlobalContextPath(provider) {
|
|
|
204
204
|
if (!config.configDir) {
|
|
205
205
|
return null;
|
|
206
206
|
}
|
|
207
|
-
return
|
|
207
|
+
return import_path2.default.join(config.configDir, config.contextFile);
|
|
208
208
|
}
|
|
209
209
|
function getGlobalSettingsPath(provider) {
|
|
210
210
|
const config = Providers[provider];
|
|
211
211
|
if (!config.configDir || !config.settingsFile) {
|
|
212
212
|
return null;
|
|
213
213
|
}
|
|
214
|
-
return
|
|
214
|
+
return import_path2.default.join(config.configDir, config.settingsFile);
|
|
215
215
|
}
|
|
216
216
|
function getSkillsPath(provider) {
|
|
217
217
|
return Providers[provider].skillsDir;
|
|
@@ -221,7 +221,7 @@ function getCommandsDir(provider) {
|
|
|
221
221
|
}
|
|
222
222
|
function getProjectCommandsPath(provider, projectRoot) {
|
|
223
223
|
const config = Providers[provider];
|
|
224
|
-
return
|
|
224
|
+
return import_path2.default.join(projectRoot, config.commandsDir);
|
|
225
225
|
}
|
|
226
226
|
function selectProvider() {
|
|
227
227
|
const detection = detectAllProviders();
|
|
@@ -255,21 +255,21 @@ function selectProvider() {
|
|
|
255
255
|
detection
|
|
256
256
|
};
|
|
257
257
|
}
|
|
258
|
-
var import_child_process,
|
|
258
|
+
var import_child_process, import_fs2, import_path2, import_os, ClaudeProvider, GeminiProvider, AntigravityProvider, CursorProvider, WindsurfProvider, Providers, ai_provider_default;
|
|
259
259
|
var init_ai_provider = __esm({
|
|
260
260
|
"core/infrastructure/ai-provider.ts"() {
|
|
261
261
|
"use strict";
|
|
262
262
|
import_child_process = require("child_process");
|
|
263
|
-
|
|
264
|
-
|
|
263
|
+
import_fs2 = __toESM(require("fs"));
|
|
264
|
+
import_path2 = __toESM(require("path"));
|
|
265
265
|
import_os = __toESM(require("os"));
|
|
266
266
|
ClaudeProvider = {
|
|
267
267
|
name: "claude",
|
|
268
268
|
displayName: "Claude Code",
|
|
269
269
|
cliCommand: "claude",
|
|
270
|
-
configDir:
|
|
270
|
+
configDir: import_path2.default.join(import_os.default.homedir(), ".claude"),
|
|
271
271
|
contextFile: "CLAUDE.md",
|
|
272
|
-
skillsDir:
|
|
272
|
+
skillsDir: import_path2.default.join(import_os.default.homedir(), ".claude", "skills"),
|
|
273
273
|
commandsDir: ".claude/commands",
|
|
274
274
|
commandFormat: "md",
|
|
275
275
|
settingsFile: "settings.json",
|
|
@@ -282,9 +282,9 @@ var init_ai_provider = __esm({
|
|
|
282
282
|
name: "gemini",
|
|
283
283
|
displayName: "Gemini CLI",
|
|
284
284
|
cliCommand: "gemini",
|
|
285
|
-
configDir:
|
|
285
|
+
configDir: import_path2.default.join(import_os.default.homedir(), ".gemini"),
|
|
286
286
|
contextFile: "GEMINI.md",
|
|
287
|
-
skillsDir:
|
|
287
|
+
skillsDir: import_path2.default.join(import_os.default.homedir(), ".gemini", "skills"),
|
|
288
288
|
commandsDir: ".gemini/commands",
|
|
289
289
|
commandFormat: "toml",
|
|
290
290
|
settingsFile: "settings.json",
|
|
@@ -298,9 +298,9 @@ var init_ai_provider = __esm({
|
|
|
298
298
|
displayName: "Google Antigravity",
|
|
299
299
|
cliCommand: null,
|
|
300
300
|
// Not a CLI command, but a platform/app
|
|
301
|
-
configDir:
|
|
301
|
+
configDir: import_path2.default.join(import_os.default.homedir(), ".gemini", "antigravity"),
|
|
302
302
|
contextFile: "ANTIGRAVITY.md",
|
|
303
|
-
skillsDir:
|
|
303
|
+
skillsDir: import_path2.default.join(import_os.default.homedir(), ".gemini", "antigravity", "global_skills"),
|
|
304
304
|
commandsDir: ".agent/skills",
|
|
305
305
|
// Antigravity uses .agent/skills in projects
|
|
306
306
|
commandFormat: "md",
|
|
@@ -427,15 +427,62 @@ __export(setup_exports, {
|
|
|
427
427
|
});
|
|
428
428
|
module.exports = __toCommonJS(setup_exports);
|
|
429
429
|
var import_child_process2 = require("child_process");
|
|
430
|
-
var
|
|
431
|
-
var
|
|
430
|
+
var import_fs4 = __toESM(require("fs"));
|
|
431
|
+
var import_path5 = __toESM(require("path"));
|
|
432
432
|
var import_os4 = __toESM(require("os"));
|
|
433
433
|
|
|
434
434
|
// core/infrastructure/command-installer.ts
|
|
435
435
|
var import_promises = __toESM(require("fs/promises"));
|
|
436
|
-
var
|
|
436
|
+
var import_path3 = __toESM(require("path"));
|
|
437
437
|
var import_os2 = __toESM(require("os"));
|
|
438
|
-
|
|
438
|
+
|
|
439
|
+
// core/utils/version.ts
|
|
440
|
+
var import_fs = __toESM(require("fs"));
|
|
441
|
+
var import_path = __toESM(require("path"));
|
|
442
|
+
var cachedVersion = null;
|
|
443
|
+
var cachedPackageJson = null;
|
|
444
|
+
var cachedPackageRoot = null;
|
|
445
|
+
function getPackageRoot() {
|
|
446
|
+
if (cachedPackageRoot) {
|
|
447
|
+
return cachedPackageRoot;
|
|
448
|
+
}
|
|
449
|
+
let currentDir = __dirname;
|
|
450
|
+
for (let i = 0; i < 5; i++) {
|
|
451
|
+
const packageJsonPath = import_path.default.join(currentDir, "package.json");
|
|
452
|
+
if (import_fs.default.existsSync(packageJsonPath)) {
|
|
453
|
+
try {
|
|
454
|
+
const pkg = JSON.parse(import_fs.default.readFileSync(packageJsonPath, "utf-8"));
|
|
455
|
+
if (pkg.name === "prjct-cli") {
|
|
456
|
+
cachedPackageRoot = currentDir;
|
|
457
|
+
return currentDir;
|
|
458
|
+
}
|
|
459
|
+
} catch (_error) {
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
currentDir = import_path.default.dirname(currentDir);
|
|
463
|
+
}
|
|
464
|
+
cachedPackageRoot = import_path.default.join(__dirname, "..", "..", "..");
|
|
465
|
+
return cachedPackageRoot;
|
|
466
|
+
}
|
|
467
|
+
__name(getPackageRoot, "getPackageRoot");
|
|
468
|
+
function getVersion() {
|
|
469
|
+
if (cachedVersion) {
|
|
470
|
+
return cachedVersion;
|
|
471
|
+
}
|
|
472
|
+
try {
|
|
473
|
+
const packageJsonPath = import_path.default.join(getPackageRoot(), "package.json");
|
|
474
|
+
const packageJson = JSON.parse(import_fs.default.readFileSync(packageJsonPath, "utf-8"));
|
|
475
|
+
cachedVersion = packageJson.version;
|
|
476
|
+
cachedPackageJson = packageJson;
|
|
477
|
+
return cachedVersion;
|
|
478
|
+
} catch (error) {
|
|
479
|
+
console.error("Failed to read version from package.json:", error.message);
|
|
480
|
+
return "0.0.0";
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
__name(getVersion, "getVersion");
|
|
484
|
+
var VERSION = getVersion();
|
|
485
|
+
var PACKAGE_ROOT = getPackageRoot();
|
|
439
486
|
|
|
440
487
|
// core/types/fs.ts
|
|
441
488
|
function isNotFoundError(error) {
|
|
@@ -446,14 +493,14 @@ __name(isNotFoundError, "isNotFoundError");
|
|
|
446
493
|
// core/infrastructure/command-installer.ts
|
|
447
494
|
async function installDocs() {
|
|
448
495
|
try {
|
|
449
|
-
const docsDir =
|
|
450
|
-
const templateDocsDir =
|
|
496
|
+
const docsDir = import_path3.default.join(import_os2.default.homedir(), ".prjct-cli", "docs");
|
|
497
|
+
const templateDocsDir = import_path3.default.join(getPackageRoot(), "templates/global/docs");
|
|
451
498
|
await import_promises.default.mkdir(docsDir, { recursive: true });
|
|
452
499
|
const docFiles = await import_promises.default.readdir(templateDocsDir);
|
|
453
500
|
for (const file of docFiles) {
|
|
454
501
|
if (file.endsWith(".md")) {
|
|
455
|
-
const srcPath =
|
|
456
|
-
const destPath =
|
|
502
|
+
const srcPath = import_path3.default.join(templateDocsDir, file);
|
|
503
|
+
const destPath = import_path3.default.join(docsDir, file);
|
|
457
504
|
const content = await import_promises.default.readFile(srcPath, "utf-8");
|
|
458
505
|
await import_promises.default.writeFile(destPath, content, "utf-8");
|
|
459
506
|
}
|
|
@@ -478,13 +525,13 @@ async function installGlobalConfig() {
|
|
|
478
525
|
}
|
|
479
526
|
try {
|
|
480
527
|
await import_promises.default.mkdir(activeProvider.configDir, { recursive: true });
|
|
481
|
-
const globalConfigPath =
|
|
482
|
-
const templatePath =
|
|
528
|
+
const globalConfigPath = import_path3.default.join(activeProvider.configDir, activeProvider.contextFile);
|
|
529
|
+
const templatePath = import_path3.default.join(getPackageRoot(), "templates", "global", activeProvider.contextFile);
|
|
483
530
|
let templateContent = "";
|
|
484
531
|
try {
|
|
485
532
|
templateContent = await import_promises.default.readFile(templatePath, "utf-8");
|
|
486
533
|
} catch (error) {
|
|
487
|
-
const fallbackTemplatePath =
|
|
534
|
+
const fallbackTemplatePath = import_path3.default.join(getPackageRoot(), "templates/global/CLAUDE.md");
|
|
488
535
|
templateContent = await import_promises.default.readFile(fallbackTemplatePath, "utf-8");
|
|
489
536
|
if (providerName === "gemini") {
|
|
490
537
|
templateContent = templateContent.replace(/Claude/g, "Gemini");
|
|
@@ -561,12 +608,12 @@ var CommandInstaller = class {
|
|
|
561
608
|
const aiProvider = (init_ai_provider(), __toCommonJS(ai_provider_exports));
|
|
562
609
|
const activeProvider = aiProvider.getActiveProvider();
|
|
563
610
|
if (activeProvider.name === "gemini") {
|
|
564
|
-
this.claudeCommandsPath =
|
|
611
|
+
this.claudeCommandsPath = import_path3.default.join(activeProvider.configDir, "commands");
|
|
565
612
|
} else {
|
|
566
|
-
this.claudeCommandsPath =
|
|
613
|
+
this.claudeCommandsPath = import_path3.default.join(activeProvider.configDir, "commands", "p");
|
|
567
614
|
}
|
|
568
615
|
this.claudeConfigPath = activeProvider.configDir;
|
|
569
|
-
this.templatesDir =
|
|
616
|
+
this.templatesDir = import_path3.default.join(getPackageRoot(), "templates", "commands");
|
|
570
617
|
}
|
|
571
618
|
/**
|
|
572
619
|
* Detect if active provider is installed
|
|
@@ -640,8 +687,8 @@ var CommandInstaller = class {
|
|
|
640
687
|
const errors = [];
|
|
641
688
|
for (const file of commandFiles) {
|
|
642
689
|
try {
|
|
643
|
-
const sourcePath =
|
|
644
|
-
const destPath =
|
|
690
|
+
const sourcePath = import_path3.default.join(this.templatesDir, file);
|
|
691
|
+
const destPath = import_path3.default.join(this.claudeCommandsPath, file);
|
|
645
692
|
const content = await import_promises.default.readFile(sourcePath, "utf-8");
|
|
646
693
|
await import_promises.default.writeFile(destPath, content, "utf-8");
|
|
647
694
|
installed.push(file.replace(".md", ""));
|
|
@@ -672,7 +719,7 @@ var CommandInstaller = class {
|
|
|
672
719
|
const errors = [];
|
|
673
720
|
for (const file of commandFiles) {
|
|
674
721
|
try {
|
|
675
|
-
const filePath =
|
|
722
|
+
const filePath = import_path3.default.join(this.claudeCommandsPath, file);
|
|
676
723
|
await import_promises.default.unlink(filePath);
|
|
677
724
|
uninstalled.push(file.replace(".md", ""));
|
|
678
725
|
} catch (error) {
|
|
@@ -757,7 +804,7 @@ var CommandInstaller = class {
|
|
|
757
804
|
*/
|
|
758
805
|
async verifyTemplate(commandName) {
|
|
759
806
|
try {
|
|
760
|
-
const templatePath =
|
|
807
|
+
const templatePath = import_path3.default.join(this.templatesDir, `${commandName}.md`);
|
|
761
808
|
await import_promises.default.access(templatePath);
|
|
762
809
|
return true;
|
|
763
810
|
} catch (error) {
|
|
@@ -776,9 +823,9 @@ var CommandInstaller = class {
|
|
|
776
823
|
const activeProvider = aiProvider.getActiveProvider();
|
|
777
824
|
const routerFile = activeProvider.name === "gemini" ? "p.toml" : "p.md";
|
|
778
825
|
try {
|
|
779
|
-
const routerSource =
|
|
780
|
-
const routerDest =
|
|
781
|
-
await import_promises.default.mkdir(
|
|
826
|
+
const routerSource = import_path3.default.join(this.templatesDir, routerFile);
|
|
827
|
+
const routerDest = import_path3.default.join(activeProvider.configDir, "commands", routerFile);
|
|
828
|
+
await import_promises.default.mkdir(import_path3.default.dirname(routerDest), { recursive: true });
|
|
782
829
|
const content = await import_promises.default.readFile(routerSource, "utf-8");
|
|
783
830
|
await import_promises.default.writeFile(routerDest, content, "utf-8");
|
|
784
831
|
return true;
|
|
@@ -827,8 +874,8 @@ var CommandInstaller = class {
|
|
|
827
874
|
};
|
|
828
875
|
for (const file of templateFiles) {
|
|
829
876
|
try {
|
|
830
|
-
const sourcePath =
|
|
831
|
-
const destPath =
|
|
877
|
+
const sourcePath = import_path3.default.join(this.templatesDir, file);
|
|
878
|
+
const destPath = import_path3.default.join(this.claudeCommandsPath, file);
|
|
832
879
|
const exists = installedFiles.includes(file);
|
|
833
880
|
const content = await import_promises.default.readFile(sourcePath, "utf-8");
|
|
834
881
|
await import_promises.default.writeFile(destPath, content, "utf-8");
|
|
@@ -870,7 +917,7 @@ var command_installer_default = commandInstaller;
|
|
|
870
917
|
|
|
871
918
|
// core/infrastructure/editors-config.ts
|
|
872
919
|
var import_promises2 = __toESM(require("fs/promises"));
|
|
873
|
-
var
|
|
920
|
+
var import_path4 = __toESM(require("path"));
|
|
874
921
|
var import_os3 = __toESM(require("os"));
|
|
875
922
|
var EditorsConfig = class {
|
|
876
923
|
static {
|
|
@@ -881,8 +928,8 @@ var EditorsConfig = class {
|
|
|
881
928
|
configFile;
|
|
882
929
|
constructor() {
|
|
883
930
|
this.homeDir = import_os3.default.homedir();
|
|
884
|
-
this.configDir =
|
|
885
|
-
this.configFile =
|
|
931
|
+
this.configDir = import_path4.default.join(this.homeDir, ".prjct-cli", "config");
|
|
932
|
+
this.configFile = import_path4.default.join(this.configDir, "installed-editors.json");
|
|
886
933
|
}
|
|
887
934
|
/**
|
|
888
935
|
* Ensure config directory exists
|
|
@@ -1002,7 +1049,6 @@ var editorsConfig = new EditorsConfig();
|
|
|
1002
1049
|
var editors_config_default = editorsConfig;
|
|
1003
1050
|
|
|
1004
1051
|
// core/infrastructure/setup.ts
|
|
1005
|
-
var import_version2 = require("../utils/version");
|
|
1006
1052
|
init_ai_provider();
|
|
1007
1053
|
var GREEN = "\x1B[32m";
|
|
1008
1054
|
var YELLOW = "\x1B[33m";
|
|
@@ -1102,7 +1148,7 @@ async function run() {
|
|
|
1102
1148
|
console.log(` ${GREEN}\u2713${NC} Antigravity skill installed`);
|
|
1103
1149
|
}
|
|
1104
1150
|
}
|
|
1105
|
-
await editors_config_default.saveConfig(
|
|
1151
|
+
await editors_config_default.saveConfig(VERSION, command_installer_default.getInstallPath(), selection.provider);
|
|
1106
1152
|
await migrateProjectsCliVersion();
|
|
1107
1153
|
for (const providerResult of results.providers) {
|
|
1108
1154
|
showResults(providerResult, Providers[providerResult.provider]);
|
|
@@ -1113,12 +1159,12 @@ __name(run, "run");
|
|
|
1113
1159
|
var setup_default = { run };
|
|
1114
1160
|
async function installGeminiRouter() {
|
|
1115
1161
|
try {
|
|
1116
|
-
const geminiCommandsDir =
|
|
1117
|
-
const routerSource =
|
|
1118
|
-
const routerDest =
|
|
1119
|
-
|
|
1120
|
-
if (
|
|
1121
|
-
|
|
1162
|
+
const geminiCommandsDir = import_path5.default.join(import_os4.default.homedir(), ".gemini", "commands");
|
|
1163
|
+
const routerSource = import_path5.default.join(getPackageRoot(), "templates", "commands", "p.toml");
|
|
1164
|
+
const routerDest = import_path5.default.join(geminiCommandsDir, "p.toml");
|
|
1165
|
+
import_fs4.default.mkdirSync(geminiCommandsDir, { recursive: true });
|
|
1166
|
+
if (import_fs4.default.existsSync(routerSource)) {
|
|
1167
|
+
import_fs4.default.copyFileSync(routerSource, routerDest);
|
|
1122
1168
|
return true;
|
|
1123
1169
|
}
|
|
1124
1170
|
return false;
|
|
@@ -1130,15 +1176,15 @@ async function installGeminiRouter() {
|
|
|
1130
1176
|
__name(installGeminiRouter, "installGeminiRouter");
|
|
1131
1177
|
async function installGeminiGlobalConfig() {
|
|
1132
1178
|
try {
|
|
1133
|
-
const geminiDir =
|
|
1134
|
-
const globalConfigPath =
|
|
1135
|
-
const templatePath =
|
|
1136
|
-
|
|
1137
|
-
const templateContent =
|
|
1179
|
+
const geminiDir = import_path5.default.join(import_os4.default.homedir(), ".gemini");
|
|
1180
|
+
const globalConfigPath = import_path5.default.join(geminiDir, "GEMINI.md");
|
|
1181
|
+
const templatePath = import_path5.default.join(getPackageRoot(), "templates", "global", "GEMINI.md");
|
|
1182
|
+
import_fs4.default.mkdirSync(geminiDir, { recursive: true });
|
|
1183
|
+
const templateContent = import_fs4.default.readFileSync(templatePath, "utf-8");
|
|
1138
1184
|
let existingContent = "";
|
|
1139
1185
|
let fileExists = false;
|
|
1140
1186
|
try {
|
|
1141
|
-
existingContent =
|
|
1187
|
+
existingContent = import_fs4.default.readFileSync(globalConfigPath, "utf-8");
|
|
1142
1188
|
fileExists = true;
|
|
1143
1189
|
} catch (error) {
|
|
1144
1190
|
if (isNotFoundError(error)) {
|
|
@@ -1148,7 +1194,7 @@ async function installGeminiGlobalConfig() {
|
|
|
1148
1194
|
}
|
|
1149
1195
|
}
|
|
1150
1196
|
if (!fileExists) {
|
|
1151
|
-
|
|
1197
|
+
import_fs4.default.writeFileSync(globalConfigPath, templateContent, "utf-8");
|
|
1152
1198
|
return { success: true, action: "created" };
|
|
1153
1199
|
}
|
|
1154
1200
|
const startMarker = "<!-- prjct:start - DO NOT REMOVE THIS MARKER -->";
|
|
@@ -1156,7 +1202,7 @@ async function installGeminiGlobalConfig() {
|
|
|
1156
1202
|
const hasMarkers = existingContent.includes(startMarker) && existingContent.includes(endMarker);
|
|
1157
1203
|
if (!hasMarkers) {
|
|
1158
1204
|
const updatedContent2 = existingContent + "\n\n" + templateContent;
|
|
1159
|
-
|
|
1205
|
+
import_fs4.default.writeFileSync(globalConfigPath, updatedContent2, "utf-8");
|
|
1160
1206
|
return { success: true, action: "appended" };
|
|
1161
1207
|
}
|
|
1162
1208
|
const beforeMarker = existingContent.substring(0, existingContent.indexOf(startMarker));
|
|
@@ -1168,7 +1214,7 @@ async function installGeminiGlobalConfig() {
|
|
|
1168
1214
|
templateContent.indexOf(endMarker) + endMarker.length
|
|
1169
1215
|
);
|
|
1170
1216
|
const updatedContent = beforeMarker + prjctSection + afterMarker;
|
|
1171
|
-
|
|
1217
|
+
import_fs4.default.writeFileSync(globalConfigPath, updatedContent, "utf-8");
|
|
1172
1218
|
return { success: true, action: "updated" };
|
|
1173
1219
|
} catch (error) {
|
|
1174
1220
|
console.error(`Gemini config warning: ${error.message}`);
|
|
@@ -1178,18 +1224,18 @@ async function installGeminiGlobalConfig() {
|
|
|
1178
1224
|
__name(installGeminiGlobalConfig, "installGeminiGlobalConfig");
|
|
1179
1225
|
async function installAntigravitySkill() {
|
|
1180
1226
|
try {
|
|
1181
|
-
const antigravitySkillsDir =
|
|
1182
|
-
const prjctSkillDir =
|
|
1183
|
-
const skillMdPath =
|
|
1184
|
-
const templatePath =
|
|
1185
|
-
|
|
1186
|
-
const fileExists =
|
|
1187
|
-
if (!
|
|
1227
|
+
const antigravitySkillsDir = import_path5.default.join(import_os4.default.homedir(), ".gemini", "antigravity", "skills");
|
|
1228
|
+
const prjctSkillDir = import_path5.default.join(antigravitySkillsDir, "prjct");
|
|
1229
|
+
const skillMdPath = import_path5.default.join(prjctSkillDir, "SKILL.md");
|
|
1230
|
+
const templatePath = import_path5.default.join(getPackageRoot(), "templates", "antigravity", "SKILL.md");
|
|
1231
|
+
import_fs4.default.mkdirSync(prjctSkillDir, { recursive: true });
|
|
1232
|
+
const fileExists = import_fs4.default.existsSync(skillMdPath);
|
|
1233
|
+
if (!import_fs4.default.existsSync(templatePath)) {
|
|
1188
1234
|
console.error("Antigravity SKILL.md template not found");
|
|
1189
1235
|
return { success: false, action: null };
|
|
1190
1236
|
}
|
|
1191
|
-
const templateContent =
|
|
1192
|
-
|
|
1237
|
+
const templateContent = import_fs4.default.readFileSync(templatePath, "utf-8");
|
|
1238
|
+
import_fs4.default.writeFileSync(skillMdPath, templateContent, "utf-8");
|
|
1193
1239
|
return { success: true, action: fileExists ? "updated" : "created" };
|
|
1194
1240
|
} catch (error) {
|
|
1195
1241
|
console.error(`Antigravity skill warning: ${error.message}`);
|
|
@@ -1210,24 +1256,24 @@ async function installCursorProject(projectRoot) {
|
|
|
1210
1256
|
gitignoreUpdated: false
|
|
1211
1257
|
};
|
|
1212
1258
|
try {
|
|
1213
|
-
const cursorDir =
|
|
1214
|
-
const rulesDir =
|
|
1215
|
-
const commandsDir =
|
|
1216
|
-
const routerMdcDest =
|
|
1217
|
-
const routerMdcSource =
|
|
1218
|
-
const cursorCommandsSource =
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
if (
|
|
1222
|
-
|
|
1259
|
+
const cursorDir = import_path5.default.join(projectRoot, ".cursor");
|
|
1260
|
+
const rulesDir = import_path5.default.join(cursorDir, "rules");
|
|
1261
|
+
const commandsDir = import_path5.default.join(cursorDir, "commands");
|
|
1262
|
+
const routerMdcDest = import_path5.default.join(rulesDir, "prjct.mdc");
|
|
1263
|
+
const routerMdcSource = import_path5.default.join(getPackageRoot(), "templates", "cursor", "router.mdc");
|
|
1264
|
+
const cursorCommandsSource = import_path5.default.join(getPackageRoot(), "templates", "cursor", "commands");
|
|
1265
|
+
import_fs4.default.mkdirSync(rulesDir, { recursive: true });
|
|
1266
|
+
import_fs4.default.mkdirSync(commandsDir, { recursive: true });
|
|
1267
|
+
if (import_fs4.default.existsSync(routerMdcSource)) {
|
|
1268
|
+
import_fs4.default.copyFileSync(routerMdcSource, routerMdcDest);
|
|
1223
1269
|
result.rulesCreated = true;
|
|
1224
1270
|
}
|
|
1225
|
-
if (
|
|
1226
|
-
const commandFiles =
|
|
1271
|
+
if (import_fs4.default.existsSync(cursorCommandsSource)) {
|
|
1272
|
+
const commandFiles = import_fs4.default.readdirSync(cursorCommandsSource).filter((f) => f.endsWith(".md"));
|
|
1227
1273
|
for (const file of commandFiles) {
|
|
1228
|
-
const src =
|
|
1229
|
-
const dest =
|
|
1230
|
-
|
|
1274
|
+
const src = import_path5.default.join(cursorCommandsSource, file);
|
|
1275
|
+
const dest = import_path5.default.join(commandsDir, file);
|
|
1276
|
+
import_fs4.default.copyFileSync(src, dest);
|
|
1231
1277
|
}
|
|
1232
1278
|
result.commandsCreated = commandFiles.length > 0;
|
|
1233
1279
|
}
|
|
@@ -1242,7 +1288,7 @@ async function installCursorProject(projectRoot) {
|
|
|
1242
1288
|
__name(installCursorProject, "installCursorProject");
|
|
1243
1289
|
async function addCursorToGitignore(projectRoot) {
|
|
1244
1290
|
try {
|
|
1245
|
-
const gitignorePath =
|
|
1291
|
+
const gitignorePath = import_path5.default.join(projectRoot, ".gitignore");
|
|
1246
1292
|
const entriesToAdd = [
|
|
1247
1293
|
"# prjct Cursor routers (regenerated per-developer)",
|
|
1248
1294
|
".cursor/rules/prjct.mdc",
|
|
@@ -1257,7 +1303,7 @@ async function addCursorToGitignore(projectRoot) {
|
|
|
1257
1303
|
let content = "";
|
|
1258
1304
|
let fileExists = false;
|
|
1259
1305
|
try {
|
|
1260
|
-
content =
|
|
1306
|
+
content = import_fs4.default.readFileSync(gitignorePath, "utf-8");
|
|
1261
1307
|
fileExists = true;
|
|
1262
1308
|
} catch (error) {
|
|
1263
1309
|
if (!isNotFoundError(error)) {
|
|
@@ -1268,7 +1314,7 @@ async function addCursorToGitignore(projectRoot) {
|
|
|
1268
1314
|
return false;
|
|
1269
1315
|
}
|
|
1270
1316
|
const newContent = fileExists ? content.trimEnd() + "\n\n" + entriesToAdd.join("\n") + "\n" : entriesToAdd.join("\n") + "\n";
|
|
1271
|
-
|
|
1317
|
+
import_fs4.default.writeFileSync(gitignorePath, newContent, "utf-8");
|
|
1272
1318
|
return true;
|
|
1273
1319
|
} catch (error) {
|
|
1274
1320
|
console.error(`Gitignore update warning: ${error.message}`);
|
|
@@ -1277,13 +1323,13 @@ async function addCursorToGitignore(projectRoot) {
|
|
|
1277
1323
|
}
|
|
1278
1324
|
__name(addCursorToGitignore, "addCursorToGitignore");
|
|
1279
1325
|
function hasCursorProject(projectRoot) {
|
|
1280
|
-
return
|
|
1326
|
+
return import_fs4.default.existsSync(import_path5.default.join(projectRoot, ".cursor"));
|
|
1281
1327
|
}
|
|
1282
1328
|
__name(hasCursorProject, "hasCursorProject");
|
|
1283
1329
|
function needsCursorRegeneration(projectRoot) {
|
|
1284
|
-
const cursorDir =
|
|
1285
|
-
const routerPath =
|
|
1286
|
-
return
|
|
1330
|
+
const cursorDir = import_path5.default.join(projectRoot, ".cursor");
|
|
1331
|
+
const routerPath = import_path5.default.join(cursorDir, "rules", "prjct.mdc");
|
|
1332
|
+
return import_fs4.default.existsSync(cursorDir) && !import_fs4.default.existsSync(routerPath);
|
|
1287
1333
|
}
|
|
1288
1334
|
__name(needsCursorRegeneration, "needsCursorRegeneration");
|
|
1289
1335
|
async function installWindsurfProject(projectRoot) {
|
|
@@ -1294,24 +1340,24 @@ async function installWindsurfProject(projectRoot) {
|
|
|
1294
1340
|
gitignoreUpdated: false
|
|
1295
1341
|
};
|
|
1296
1342
|
try {
|
|
1297
|
-
const windsurfDir =
|
|
1298
|
-
const rulesDir =
|
|
1299
|
-
const workflowsDir =
|
|
1300
|
-
const routerDest =
|
|
1301
|
-
const routerSource =
|
|
1302
|
-
const windsurfWorkflowsSource =
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
if (
|
|
1306
|
-
|
|
1343
|
+
const windsurfDir = import_path5.default.join(projectRoot, ".windsurf");
|
|
1344
|
+
const rulesDir = import_path5.default.join(windsurfDir, "rules");
|
|
1345
|
+
const workflowsDir = import_path5.default.join(windsurfDir, "workflows");
|
|
1346
|
+
const routerDest = import_path5.default.join(rulesDir, "prjct.md");
|
|
1347
|
+
const routerSource = import_path5.default.join(getPackageRoot(), "templates", "windsurf", "router.md");
|
|
1348
|
+
const windsurfWorkflowsSource = import_path5.default.join(getPackageRoot(), "templates", "windsurf", "workflows");
|
|
1349
|
+
import_fs4.default.mkdirSync(rulesDir, { recursive: true });
|
|
1350
|
+
import_fs4.default.mkdirSync(workflowsDir, { recursive: true });
|
|
1351
|
+
if (import_fs4.default.existsSync(routerSource)) {
|
|
1352
|
+
import_fs4.default.copyFileSync(routerSource, routerDest);
|
|
1307
1353
|
result.rulesCreated = true;
|
|
1308
1354
|
}
|
|
1309
|
-
if (
|
|
1310
|
-
const workflowFiles =
|
|
1355
|
+
if (import_fs4.default.existsSync(windsurfWorkflowsSource)) {
|
|
1356
|
+
const workflowFiles = import_fs4.default.readdirSync(windsurfWorkflowsSource).filter((f) => f.endsWith(".md"));
|
|
1311
1357
|
for (const file of workflowFiles) {
|
|
1312
|
-
const src =
|
|
1313
|
-
const dest =
|
|
1314
|
-
|
|
1358
|
+
const src = import_path5.default.join(windsurfWorkflowsSource, file);
|
|
1359
|
+
const dest = import_path5.default.join(workflowsDir, file);
|
|
1360
|
+
import_fs4.default.copyFileSync(src, dest);
|
|
1315
1361
|
}
|
|
1316
1362
|
result.workflowsCreated = workflowFiles.length > 0;
|
|
1317
1363
|
}
|
|
@@ -1326,7 +1372,7 @@ async function installWindsurfProject(projectRoot) {
|
|
|
1326
1372
|
__name(installWindsurfProject, "installWindsurfProject");
|
|
1327
1373
|
async function addWindsurfToGitignore(projectRoot) {
|
|
1328
1374
|
try {
|
|
1329
|
-
const gitignorePath =
|
|
1375
|
+
const gitignorePath = import_path5.default.join(projectRoot, ".gitignore");
|
|
1330
1376
|
const entriesToAdd = [
|
|
1331
1377
|
"# prjct Windsurf routers (regenerated per-developer)",
|
|
1332
1378
|
".windsurf/rules/prjct.md",
|
|
@@ -1341,7 +1387,7 @@ async function addWindsurfToGitignore(projectRoot) {
|
|
|
1341
1387
|
let content = "";
|
|
1342
1388
|
let fileExists = false;
|
|
1343
1389
|
try {
|
|
1344
|
-
content =
|
|
1390
|
+
content = import_fs4.default.readFileSync(gitignorePath, "utf-8");
|
|
1345
1391
|
fileExists = true;
|
|
1346
1392
|
} catch (error) {
|
|
1347
1393
|
if (!isNotFoundError(error)) {
|
|
@@ -1352,7 +1398,7 @@ async function addWindsurfToGitignore(projectRoot) {
|
|
|
1352
1398
|
return false;
|
|
1353
1399
|
}
|
|
1354
1400
|
const newContent = fileExists ? content.trimEnd() + "\n\n" + entriesToAdd.join("\n") + "\n" : entriesToAdd.join("\n") + "\n";
|
|
1355
|
-
|
|
1401
|
+
import_fs4.default.writeFileSync(gitignorePath, newContent, "utf-8");
|
|
1356
1402
|
return true;
|
|
1357
1403
|
} catch (error) {
|
|
1358
1404
|
console.error(`Gitignore update warning: ${error.message}`);
|
|
@@ -1361,34 +1407,34 @@ async function addWindsurfToGitignore(projectRoot) {
|
|
|
1361
1407
|
}
|
|
1362
1408
|
__name(addWindsurfToGitignore, "addWindsurfToGitignore");
|
|
1363
1409
|
function hasWindsurfProject(projectRoot) {
|
|
1364
|
-
return
|
|
1410
|
+
return import_fs4.default.existsSync(import_path5.default.join(projectRoot, ".windsurf"));
|
|
1365
1411
|
}
|
|
1366
1412
|
__name(hasWindsurfProject, "hasWindsurfProject");
|
|
1367
1413
|
function needsWindsurfRegeneration(projectRoot) {
|
|
1368
|
-
const windsurfDir =
|
|
1369
|
-
const routerPath =
|
|
1370
|
-
return
|
|
1414
|
+
const windsurfDir = import_path5.default.join(projectRoot, ".windsurf");
|
|
1415
|
+
const routerPath = import_path5.default.join(windsurfDir, "rules", "prjct.md");
|
|
1416
|
+
return import_fs4.default.existsSync(windsurfDir) && !import_fs4.default.existsSync(routerPath);
|
|
1371
1417
|
}
|
|
1372
1418
|
__name(needsWindsurfRegeneration, "needsWindsurfRegeneration");
|
|
1373
1419
|
async function migrateProjectsCliVersion() {
|
|
1374
1420
|
try {
|
|
1375
|
-
const projectsDir =
|
|
1376
|
-
if (!
|
|
1421
|
+
const projectsDir = import_path5.default.join(import_os4.default.homedir(), ".prjct-cli", "projects");
|
|
1422
|
+
if (!import_fs4.default.existsSync(projectsDir)) {
|
|
1377
1423
|
return;
|
|
1378
1424
|
}
|
|
1379
|
-
const projectDirs =
|
|
1425
|
+
const projectDirs = import_fs4.default.readdirSync(projectsDir, { withFileTypes: true }).filter((dirent) => dirent.isDirectory()).map((dirent) => dirent.name);
|
|
1380
1426
|
let migrated = 0;
|
|
1381
1427
|
for (const projectId of projectDirs) {
|
|
1382
|
-
const projectJsonPath =
|
|
1383
|
-
if (!
|
|
1428
|
+
const projectJsonPath = import_path5.default.join(projectsDir, projectId, "project.json");
|
|
1429
|
+
if (!import_fs4.default.existsSync(projectJsonPath)) {
|
|
1384
1430
|
continue;
|
|
1385
1431
|
}
|
|
1386
1432
|
try {
|
|
1387
|
-
const content =
|
|
1433
|
+
const content = import_fs4.default.readFileSync(projectJsonPath, "utf8");
|
|
1388
1434
|
const project = JSON.parse(content);
|
|
1389
|
-
if (project.cliVersion !==
|
|
1390
|
-
project.cliVersion =
|
|
1391
|
-
|
|
1435
|
+
if (project.cliVersion !== VERSION) {
|
|
1436
|
+
project.cliVersion = VERSION;
|
|
1437
|
+
import_fs4.default.writeFileSync(projectJsonPath, JSON.stringify(project, null, 2));
|
|
1392
1438
|
migrated++;
|
|
1393
1439
|
}
|
|
1394
1440
|
} catch (error) {
|
|
@@ -1398,7 +1444,7 @@ async function migrateProjectsCliVersion() {
|
|
|
1398
1444
|
}
|
|
1399
1445
|
}
|
|
1400
1446
|
if (migrated > 0) {
|
|
1401
|
-
console.log(` ${GREEN}\u2713${NC} Updated ${migrated} project(s) to v${
|
|
1447
|
+
console.log(` ${GREEN}\u2713${NC} Updated ${migrated} project(s) to v${VERSION}`);
|
|
1402
1448
|
}
|
|
1403
1449
|
} catch (error) {
|
|
1404
1450
|
if (!isNotFoundError(error)) {
|
|
@@ -1409,9 +1455,9 @@ async function migrateProjectsCliVersion() {
|
|
|
1409
1455
|
__name(migrateProjectsCliVersion, "migrateProjectsCliVersion");
|
|
1410
1456
|
function ensureStatusLineSettings(settingsPath, statusLinePath) {
|
|
1411
1457
|
let settings = {};
|
|
1412
|
-
if (
|
|
1458
|
+
if (import_fs4.default.existsSync(settingsPath)) {
|
|
1413
1459
|
try {
|
|
1414
|
-
settings = JSON.parse(
|
|
1460
|
+
settings = JSON.parse(import_fs4.default.readFileSync(settingsPath, "utf8"));
|
|
1415
1461
|
} catch (error) {
|
|
1416
1462
|
if (!(error instanceof SyntaxError)) {
|
|
1417
1463
|
throw error;
|
|
@@ -1419,51 +1465,51 @@ function ensureStatusLineSettings(settingsPath, statusLinePath) {
|
|
|
1419
1465
|
}
|
|
1420
1466
|
}
|
|
1421
1467
|
settings.statusLine = { type: "command", command: statusLinePath };
|
|
1422
|
-
|
|
1468
|
+
import_fs4.default.writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
|
|
1423
1469
|
}
|
|
1424
1470
|
__name(ensureStatusLineSettings, "ensureStatusLineSettings");
|
|
1425
1471
|
async function installStatusLine() {
|
|
1426
1472
|
try {
|
|
1427
|
-
const claudeDir =
|
|
1428
|
-
const settingsPath =
|
|
1429
|
-
const claudeStatusLinePath =
|
|
1430
|
-
const prjctStatusLineDir =
|
|
1431
|
-
const prjctStatusLinePath =
|
|
1432
|
-
const prjctThemesDir =
|
|
1433
|
-
const prjctLibDir =
|
|
1434
|
-
const prjctComponentsDir =
|
|
1435
|
-
const prjctConfigPath =
|
|
1436
|
-
const assetsDir =
|
|
1437
|
-
const sourceScript =
|
|
1438
|
-
const sourceThemeDir =
|
|
1439
|
-
const sourceLibDir =
|
|
1440
|
-
const sourceComponentsDir =
|
|
1441
|
-
const sourceConfigPath =
|
|
1442
|
-
if (!
|
|
1443
|
-
|
|
1473
|
+
const claudeDir = import_path5.default.join(import_os4.default.homedir(), ".claude");
|
|
1474
|
+
const settingsPath = import_path5.default.join(claudeDir, "settings.json");
|
|
1475
|
+
const claudeStatusLinePath = import_path5.default.join(claudeDir, "prjct-statusline.sh");
|
|
1476
|
+
const prjctStatusLineDir = import_path5.default.join(import_os4.default.homedir(), ".prjct-cli", "statusline");
|
|
1477
|
+
const prjctStatusLinePath = import_path5.default.join(prjctStatusLineDir, "statusline.sh");
|
|
1478
|
+
const prjctThemesDir = import_path5.default.join(prjctStatusLineDir, "themes");
|
|
1479
|
+
const prjctLibDir = import_path5.default.join(prjctStatusLineDir, "lib");
|
|
1480
|
+
const prjctComponentsDir = import_path5.default.join(prjctStatusLineDir, "components");
|
|
1481
|
+
const prjctConfigPath = import_path5.default.join(prjctStatusLineDir, "config.json");
|
|
1482
|
+
const assetsDir = import_path5.default.join(getPackageRoot(), "assets", "statusline");
|
|
1483
|
+
const sourceScript = import_path5.default.join(assetsDir, "statusline.sh");
|
|
1484
|
+
const sourceThemeDir = import_path5.default.join(assetsDir, "themes");
|
|
1485
|
+
const sourceLibDir = import_path5.default.join(assetsDir, "lib");
|
|
1486
|
+
const sourceComponentsDir = import_path5.default.join(assetsDir, "components");
|
|
1487
|
+
const sourceConfigPath = import_path5.default.join(assetsDir, "default-config.json");
|
|
1488
|
+
if (!import_fs4.default.existsSync(claudeDir)) {
|
|
1489
|
+
import_fs4.default.mkdirSync(claudeDir, { recursive: true });
|
|
1444
1490
|
}
|
|
1445
|
-
if (!
|
|
1446
|
-
|
|
1491
|
+
if (!import_fs4.default.existsSync(prjctStatusLineDir)) {
|
|
1492
|
+
import_fs4.default.mkdirSync(prjctStatusLineDir, { recursive: true });
|
|
1447
1493
|
}
|
|
1448
|
-
if (!
|
|
1449
|
-
|
|
1494
|
+
if (!import_fs4.default.existsSync(prjctThemesDir)) {
|
|
1495
|
+
import_fs4.default.mkdirSync(prjctThemesDir, { recursive: true });
|
|
1450
1496
|
}
|
|
1451
|
-
if (!
|
|
1452
|
-
|
|
1497
|
+
if (!import_fs4.default.existsSync(prjctLibDir)) {
|
|
1498
|
+
import_fs4.default.mkdirSync(prjctLibDir, { recursive: true });
|
|
1453
1499
|
}
|
|
1454
|
-
if (!
|
|
1455
|
-
|
|
1500
|
+
if (!import_fs4.default.existsSync(prjctComponentsDir)) {
|
|
1501
|
+
import_fs4.default.mkdirSync(prjctComponentsDir, { recursive: true });
|
|
1456
1502
|
}
|
|
1457
|
-
if (
|
|
1458
|
-
const existingContent =
|
|
1503
|
+
if (import_fs4.default.existsSync(prjctStatusLinePath)) {
|
|
1504
|
+
const existingContent = import_fs4.default.readFileSync(prjctStatusLinePath, "utf8");
|
|
1459
1505
|
if (existingContent.includes("CLI_VERSION=")) {
|
|
1460
1506
|
const versionMatch = existingContent.match(/CLI_VERSION="([^"]*)"/);
|
|
1461
|
-
if (versionMatch && versionMatch[1] !==
|
|
1507
|
+
if (versionMatch && versionMatch[1] !== VERSION) {
|
|
1462
1508
|
const updatedContent = existingContent.replace(
|
|
1463
1509
|
/CLI_VERSION="[^"]*"/,
|
|
1464
|
-
`CLI_VERSION="${
|
|
1510
|
+
`CLI_VERSION="${VERSION}"`
|
|
1465
1511
|
);
|
|
1466
|
-
|
|
1512
|
+
import_fs4.default.writeFileSync(prjctStatusLinePath, updatedContent, { mode: 493 });
|
|
1467
1513
|
}
|
|
1468
1514
|
installStatusLineModules(sourceLibDir, prjctLibDir);
|
|
1469
1515
|
installStatusLineModules(sourceComponentsDir, prjctComponentsDir);
|
|
@@ -1472,30 +1518,30 @@ async function installStatusLine() {
|
|
|
1472
1518
|
return;
|
|
1473
1519
|
}
|
|
1474
1520
|
}
|
|
1475
|
-
if (
|
|
1476
|
-
let scriptContent =
|
|
1521
|
+
if (import_fs4.default.existsSync(sourceScript)) {
|
|
1522
|
+
let scriptContent = import_fs4.default.readFileSync(sourceScript, "utf8");
|
|
1477
1523
|
scriptContent = scriptContent.replace(
|
|
1478
1524
|
/CLI_VERSION="[^"]*"/,
|
|
1479
|
-
`CLI_VERSION="${
|
|
1525
|
+
`CLI_VERSION="${VERSION}"`
|
|
1480
1526
|
);
|
|
1481
|
-
|
|
1527
|
+
import_fs4.default.writeFileSync(prjctStatusLinePath, scriptContent, { mode: 493 });
|
|
1482
1528
|
installStatusLineModules(sourceLibDir, prjctLibDir);
|
|
1483
1529
|
installStatusLineModules(sourceComponentsDir, prjctComponentsDir);
|
|
1484
|
-
if (
|
|
1485
|
-
const themes =
|
|
1530
|
+
if (import_fs4.default.existsSync(sourceThemeDir)) {
|
|
1531
|
+
const themes = import_fs4.default.readdirSync(sourceThemeDir);
|
|
1486
1532
|
for (const theme of themes) {
|
|
1487
|
-
const src =
|
|
1488
|
-
const dest =
|
|
1489
|
-
|
|
1533
|
+
const src = import_path5.default.join(sourceThemeDir, theme);
|
|
1534
|
+
const dest = import_path5.default.join(prjctThemesDir, theme);
|
|
1535
|
+
import_fs4.default.copyFileSync(src, dest);
|
|
1490
1536
|
}
|
|
1491
1537
|
}
|
|
1492
|
-
if (!
|
|
1493
|
-
|
|
1538
|
+
if (!import_fs4.default.existsSync(prjctConfigPath) && import_fs4.default.existsSync(sourceConfigPath)) {
|
|
1539
|
+
import_fs4.default.copyFileSync(sourceConfigPath, prjctConfigPath);
|
|
1494
1540
|
}
|
|
1495
1541
|
} else {
|
|
1496
1542
|
const scriptContent = `#!/bin/bash
|
|
1497
1543
|
# prjct Status Line for Claude Code
|
|
1498
|
-
CLI_VERSION="${
|
|
1544
|
+
CLI_VERSION="${VERSION}"
|
|
1499
1545
|
input=$(cat)
|
|
1500
1546
|
CWD=$(echo "$input" | jq -r '.workspace.current_dir // "~"' 2>/dev/null)
|
|
1501
1547
|
CONFIG="$CWD/.prjct/prjct.config.json"
|
|
@@ -1525,7 +1571,7 @@ if [ -f "$CONFIG" ]; then
|
|
|
1525
1571
|
fi
|
|
1526
1572
|
echo "prjct"
|
|
1527
1573
|
`;
|
|
1528
|
-
|
|
1574
|
+
import_fs4.default.writeFileSync(prjctStatusLinePath, scriptContent, { mode: 493 });
|
|
1529
1575
|
}
|
|
1530
1576
|
ensureStatusLineSymlink(claudeStatusLinePath, prjctStatusLinePath);
|
|
1531
1577
|
ensureStatusLineSettings(settingsPath, claudeStatusLinePath);
|
|
@@ -1537,38 +1583,38 @@ echo "prjct"
|
|
|
1537
1583
|
}
|
|
1538
1584
|
__name(installStatusLine, "installStatusLine");
|
|
1539
1585
|
function installStatusLineModules(sourceDir, destDir) {
|
|
1540
|
-
if (!
|
|
1586
|
+
if (!import_fs4.default.existsSync(sourceDir)) {
|
|
1541
1587
|
return;
|
|
1542
1588
|
}
|
|
1543
|
-
const files =
|
|
1589
|
+
const files = import_fs4.default.readdirSync(sourceDir);
|
|
1544
1590
|
for (const file of files) {
|
|
1545
1591
|
if (file.endsWith(".sh")) {
|
|
1546
|
-
const src =
|
|
1547
|
-
const dest =
|
|
1548
|
-
|
|
1549
|
-
|
|
1592
|
+
const src = import_path5.default.join(sourceDir, file);
|
|
1593
|
+
const dest = import_path5.default.join(destDir, file);
|
|
1594
|
+
import_fs4.default.copyFileSync(src, dest);
|
|
1595
|
+
import_fs4.default.chmodSync(dest, 493);
|
|
1550
1596
|
}
|
|
1551
1597
|
}
|
|
1552
1598
|
}
|
|
1553
1599
|
__name(installStatusLineModules, "installStatusLineModules");
|
|
1554
1600
|
function ensureStatusLineSymlink(linkPath, targetPath) {
|
|
1555
1601
|
try {
|
|
1556
|
-
if (
|
|
1557
|
-
const stats =
|
|
1602
|
+
if (import_fs4.default.existsSync(linkPath)) {
|
|
1603
|
+
const stats = import_fs4.default.lstatSync(linkPath);
|
|
1558
1604
|
if (stats.isSymbolicLink()) {
|
|
1559
|
-
const existingTarget =
|
|
1605
|
+
const existingTarget = import_fs4.default.readlinkSync(linkPath);
|
|
1560
1606
|
if (existingTarget === targetPath) {
|
|
1561
1607
|
return;
|
|
1562
1608
|
}
|
|
1563
1609
|
}
|
|
1564
|
-
|
|
1610
|
+
import_fs4.default.unlinkSync(linkPath);
|
|
1565
1611
|
}
|
|
1566
|
-
|
|
1612
|
+
import_fs4.default.symlinkSync(targetPath, linkPath);
|
|
1567
1613
|
} catch (error) {
|
|
1568
1614
|
try {
|
|
1569
|
-
if (
|
|
1570
|
-
|
|
1571
|
-
|
|
1615
|
+
if (import_fs4.default.existsSync(targetPath)) {
|
|
1616
|
+
import_fs4.default.copyFileSync(targetPath, linkPath);
|
|
1617
|
+
import_fs4.default.chmodSync(linkPath, 493);
|
|
1572
1618
|
}
|
|
1573
1619
|
} catch (copyError) {
|
|
1574
1620
|
if (!isNotFoundError(copyError)) {
|