prjct-cli 0.29.6 → 0.29.8
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/assets/statusline/statusline.sh +2 -33
- package/dist/bin/prjct.mjs +1 -1
- package/dist/core/infrastructure/setup.js +150 -102
- package/package.json +1 -1
- package/templates/commands/update.md +44 -20
|
@@ -48,39 +48,8 @@ load_config
|
|
|
48
48
|
load_theme
|
|
49
49
|
parse_stdin "$INPUT"
|
|
50
50
|
|
|
51
|
-
#
|
|
52
|
-
#
|
|
53
|
-
# ============================================================================
|
|
54
|
-
check_version_upgrade() {
|
|
55
|
-
local config_file="${CWD}/.prjct/prjct.config.json"
|
|
56
|
-
|
|
57
|
-
[[ ! -f "$config_file" ]] && return 1
|
|
58
|
-
|
|
59
|
-
local project_id=$(jq -r '.projectId // ""' "$config_file" 2>/dev/null)
|
|
60
|
-
[[ -z "$project_id" ]] && return 1
|
|
61
|
-
|
|
62
|
-
local project_json="${HOME}/.prjct-cli/projects/${project_id}/project.json"
|
|
63
|
-
[[ ! -f "$project_json" ]] && {
|
|
64
|
-
echo -e "${WARNING}prjct v${CLI_VERSION}${NC} ${MUTED}run p. sync${NC}"
|
|
65
|
-
return 0
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
local project_version=$(jq -r '.cliVersion // ""' "$project_json" 2>/dev/null)
|
|
69
|
-
|
|
70
|
-
if [[ -z "$project_version" ]] || [[ "$project_version" != "$CLI_VERSION" ]]; then
|
|
71
|
-
echo -e "${WARNING}prjct v${CLI_VERSION}${NC} ${MUTED}run p. sync${NC}"
|
|
72
|
-
return 0
|
|
73
|
-
fi
|
|
74
|
-
|
|
75
|
-
return 1
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
# Check for version upgrade first
|
|
79
|
-
VERSION_MSG=$(check_version_upgrade)
|
|
80
|
-
if [[ -n "$VERSION_MSG" ]]; then
|
|
81
|
-
echo -e "$VERSION_MSG"
|
|
82
|
-
exit 0
|
|
83
|
-
fi
|
|
51
|
+
# Version check removed - was causing confusing duplicate statusline display
|
|
52
|
+
# Users will see update prompts when running p. commands
|
|
84
53
|
|
|
85
54
|
# ============================================================================
|
|
86
55
|
# Build Statusline
|
package/dist/bin/prjct.mjs
CHANGED
|
@@ -12534,7 +12534,7 @@ var require_package = __commonJS({
|
|
|
12534
12534
|
"package.json"(exports, module) {
|
|
12535
12535
|
module.exports = {
|
|
12536
12536
|
name: "prjct-cli",
|
|
12537
|
-
version: "0.29.
|
|
12537
|
+
version: "0.29.7",
|
|
12538
12538
|
description: "Built for Claude - Ship fast, track progress, stay focused. Developer momentum tool for indie hackers.",
|
|
12539
12539
|
main: "core/index.ts",
|
|
12540
12540
|
bin: {
|
|
@@ -36,25 +36,74 @@ __export(setup_exports, {
|
|
|
36
36
|
});
|
|
37
37
|
module.exports = __toCommonJS(setup_exports);
|
|
38
38
|
var import_child_process = require("child_process");
|
|
39
|
-
var
|
|
40
|
-
var
|
|
39
|
+
var import_fs2 = __toESM(require("fs"));
|
|
40
|
+
var import_path4 = __toESM(require("path"));
|
|
41
41
|
var import_os3 = __toESM(require("os"));
|
|
42
42
|
|
|
43
43
|
// core/infrastructure/command-installer.ts
|
|
44
44
|
var import_promises = __toESM(require("fs/promises"));
|
|
45
|
-
var
|
|
45
|
+
var import_path2 = __toESM(require("path"));
|
|
46
46
|
var import_os = __toESM(require("os"));
|
|
47
|
-
|
|
47
|
+
|
|
48
|
+
// core/utils/version.ts
|
|
49
|
+
var import_fs = __toESM(require("fs"));
|
|
50
|
+
var import_path = __toESM(require("path"));
|
|
51
|
+
var cachedVersion = null;
|
|
52
|
+
var cachedPackageJson = null;
|
|
53
|
+
var cachedPackageRoot = null;
|
|
54
|
+
function getPackageRoot() {
|
|
55
|
+
if (cachedPackageRoot) {
|
|
56
|
+
return cachedPackageRoot;
|
|
57
|
+
}
|
|
58
|
+
let currentDir = __dirname;
|
|
59
|
+
for (let i = 0; i < 5; i++) {
|
|
60
|
+
const packageJsonPath = import_path.default.join(currentDir, "package.json");
|
|
61
|
+
if (import_fs.default.existsSync(packageJsonPath)) {
|
|
62
|
+
try {
|
|
63
|
+
const pkg = JSON.parse(import_fs.default.readFileSync(packageJsonPath, "utf-8"));
|
|
64
|
+
if (pkg.name === "prjct-cli") {
|
|
65
|
+
cachedPackageRoot = currentDir;
|
|
66
|
+
return currentDir;
|
|
67
|
+
}
|
|
68
|
+
} catch {
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
currentDir = import_path.default.dirname(currentDir);
|
|
72
|
+
}
|
|
73
|
+
cachedPackageRoot = import_path.default.join(__dirname, "..", "..", "..");
|
|
74
|
+
return cachedPackageRoot;
|
|
75
|
+
}
|
|
76
|
+
__name(getPackageRoot, "getPackageRoot");
|
|
77
|
+
function getVersion() {
|
|
78
|
+
if (cachedVersion) {
|
|
79
|
+
return cachedVersion;
|
|
80
|
+
}
|
|
81
|
+
try {
|
|
82
|
+
const packageJsonPath = import_path.default.join(getPackageRoot(), "package.json");
|
|
83
|
+
const packageJson = JSON.parse(import_fs.default.readFileSync(packageJsonPath, "utf-8"));
|
|
84
|
+
cachedVersion = packageJson.version;
|
|
85
|
+
cachedPackageJson = packageJson;
|
|
86
|
+
return cachedVersion;
|
|
87
|
+
} catch (error) {
|
|
88
|
+
console.error("Failed to read version from package.json:", error.message);
|
|
89
|
+
return "0.0.0";
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
__name(getVersion, "getVersion");
|
|
93
|
+
var VERSION = getVersion();
|
|
94
|
+
var PACKAGE_ROOT = getPackageRoot();
|
|
95
|
+
|
|
96
|
+
// core/infrastructure/command-installer.ts
|
|
48
97
|
async function installDocs() {
|
|
49
98
|
try {
|
|
50
|
-
const docsDir =
|
|
51
|
-
const templateDocsDir =
|
|
99
|
+
const docsDir = import_path2.default.join(import_os.default.homedir(), ".prjct-cli", "docs");
|
|
100
|
+
const templateDocsDir = import_path2.default.join(getPackageRoot(), "templates/global/docs");
|
|
52
101
|
await import_promises.default.mkdir(docsDir, { recursive: true });
|
|
53
102
|
const docFiles = await import_promises.default.readdir(templateDocsDir);
|
|
54
103
|
for (const file of docFiles) {
|
|
55
104
|
if (file.endsWith(".md")) {
|
|
56
|
-
const srcPath =
|
|
57
|
-
const destPath =
|
|
105
|
+
const srcPath = import_path2.default.join(templateDocsDir, file);
|
|
106
|
+
const destPath = import_path2.default.join(docsDir, file);
|
|
58
107
|
const content = await import_promises.default.readFile(srcPath, "utf-8");
|
|
59
108
|
await import_promises.default.writeFile(destPath, content, "utf-8");
|
|
60
109
|
}
|
|
@@ -75,10 +124,10 @@ async function installGlobalConfig(claudeConfigPath, detectClaude) {
|
|
|
75
124
|
};
|
|
76
125
|
}
|
|
77
126
|
try {
|
|
78
|
-
const claudeDir =
|
|
127
|
+
const claudeDir = import_path2.default.join(import_os.default.homedir(), ".claude");
|
|
79
128
|
await import_promises.default.mkdir(claudeDir, { recursive: true });
|
|
80
|
-
const globalConfigPath =
|
|
81
|
-
const templatePath =
|
|
129
|
+
const globalConfigPath = import_path2.default.join(claudeDir, "CLAUDE.md");
|
|
130
|
+
const templatePath = import_path2.default.join(getPackageRoot(), "templates/global/CLAUDE.md");
|
|
82
131
|
const templateContent = await import_promises.default.readFile(templatePath, "utf-8");
|
|
83
132
|
let existingContent = "";
|
|
84
133
|
let fileExists = false;
|
|
@@ -144,9 +193,9 @@ var CommandInstaller = class {
|
|
|
144
193
|
templatesDir;
|
|
145
194
|
constructor() {
|
|
146
195
|
this.homeDir = import_os.default.homedir();
|
|
147
|
-
this.claudeCommandsPath =
|
|
148
|
-
this.claudeConfigPath =
|
|
149
|
-
this.templatesDir =
|
|
196
|
+
this.claudeCommandsPath = import_path2.default.join(this.homeDir, ".claude", "commands", "p");
|
|
197
|
+
this.claudeConfigPath = import_path2.default.join(this.homeDir, ".claude");
|
|
198
|
+
this.templatesDir = import_path2.default.join(getPackageRoot(), "templates", "commands");
|
|
150
199
|
}
|
|
151
200
|
/**
|
|
152
201
|
* Detect if Claude is installed
|
|
@@ -209,8 +258,8 @@ var CommandInstaller = class {
|
|
|
209
258
|
const errors = [];
|
|
210
259
|
for (const file of commandFiles) {
|
|
211
260
|
try {
|
|
212
|
-
const sourcePath =
|
|
213
|
-
const destPath =
|
|
261
|
+
const sourcePath = import_path2.default.join(this.templatesDir, file);
|
|
262
|
+
const destPath = import_path2.default.join(this.claudeCommandsPath, file);
|
|
214
263
|
const content = await import_promises.default.readFile(sourcePath, "utf-8");
|
|
215
264
|
await import_promises.default.writeFile(destPath, content, "utf-8");
|
|
216
265
|
installed.push(file.replace(".md", ""));
|
|
@@ -241,7 +290,7 @@ var CommandInstaller = class {
|
|
|
241
290
|
const errors = [];
|
|
242
291
|
for (const file of commandFiles) {
|
|
243
292
|
try {
|
|
244
|
-
const filePath =
|
|
293
|
+
const filePath = import_path2.default.join(this.claudeCommandsPath, file);
|
|
245
294
|
await import_promises.default.unlink(filePath);
|
|
246
295
|
uninstalled.push(file.replace(".md", ""));
|
|
247
296
|
} catch (error) {
|
|
@@ -323,7 +372,7 @@ var CommandInstaller = class {
|
|
|
323
372
|
*/
|
|
324
373
|
async verifyTemplate(commandName) {
|
|
325
374
|
try {
|
|
326
|
-
const templatePath =
|
|
375
|
+
const templatePath = import_path2.default.join(this.templatesDir, `${commandName}.md`);
|
|
327
376
|
await import_promises.default.access(templatePath);
|
|
328
377
|
return true;
|
|
329
378
|
} catch {
|
|
@@ -337,8 +386,8 @@ var CommandInstaller = class {
|
|
|
337
386
|
*/
|
|
338
387
|
async installRouter() {
|
|
339
388
|
try {
|
|
340
|
-
const routerSource =
|
|
341
|
-
const routerDest =
|
|
389
|
+
const routerSource = import_path2.default.join(this.templatesDir, "p.md");
|
|
390
|
+
const routerDest = import_path2.default.join(this.homeDir, ".claude", "commands", "p.md");
|
|
342
391
|
const content = await import_promises.default.readFile(routerSource, "utf-8");
|
|
343
392
|
await import_promises.default.writeFile(routerDest, content, "utf-8");
|
|
344
393
|
return true;
|
|
@@ -380,8 +429,8 @@ var CommandInstaller = class {
|
|
|
380
429
|
};
|
|
381
430
|
for (const file of templateFiles) {
|
|
382
431
|
try {
|
|
383
|
-
const sourcePath =
|
|
384
|
-
const destPath =
|
|
432
|
+
const sourcePath = import_path2.default.join(this.templatesDir, file);
|
|
433
|
+
const destPath = import_path2.default.join(this.claudeCommandsPath, file);
|
|
385
434
|
const exists = installedFiles.includes(file);
|
|
386
435
|
const content = await import_promises.default.readFile(sourcePath, "utf-8");
|
|
387
436
|
await import_promises.default.writeFile(destPath, content, "utf-8");
|
|
@@ -423,7 +472,7 @@ var command_installer_default = commandInstaller;
|
|
|
423
472
|
|
|
424
473
|
// core/infrastructure/editors-config.ts
|
|
425
474
|
var import_promises2 = __toESM(require("fs/promises"));
|
|
426
|
-
var
|
|
475
|
+
var import_path3 = __toESM(require("path"));
|
|
427
476
|
var import_os2 = __toESM(require("os"));
|
|
428
477
|
var EditorsConfig = class {
|
|
429
478
|
static {
|
|
@@ -434,8 +483,8 @@ var EditorsConfig = class {
|
|
|
434
483
|
configFile;
|
|
435
484
|
constructor() {
|
|
436
485
|
this.homeDir = import_os2.default.homedir();
|
|
437
|
-
this.configDir =
|
|
438
|
-
this.configFile =
|
|
486
|
+
this.configDir = import_path3.default.join(this.homeDir, ".prjct-cli", "config");
|
|
487
|
+
this.configFile = import_path3.default.join(this.configDir, "installed-editors.json");
|
|
439
488
|
}
|
|
440
489
|
/**
|
|
441
490
|
* Ensure config directory exists
|
|
@@ -545,7 +594,6 @@ var editorsConfig = new EditorsConfig();
|
|
|
545
594
|
var editors_config_default = editorsConfig;
|
|
546
595
|
|
|
547
596
|
// core/infrastructure/setup.ts
|
|
548
|
-
var import_version2 = require("../utils/version");
|
|
549
597
|
var GREEN = "\x1B[32m";
|
|
550
598
|
var YELLOW = "\x1B[33m";
|
|
551
599
|
var DIM = "\x1B[2m";
|
|
@@ -606,7 +654,7 @@ async function run() {
|
|
|
606
654
|
await command_installer_default.installDocs();
|
|
607
655
|
await installStatusLine();
|
|
608
656
|
}
|
|
609
|
-
await editors_config_default.saveConfig(
|
|
657
|
+
await editors_config_default.saveConfig(VERSION, command_installer_default.getInstallPath());
|
|
610
658
|
await migrateProjectsCliVersion();
|
|
611
659
|
showResults(results);
|
|
612
660
|
return results;
|
|
@@ -615,30 +663,30 @@ __name(run, "run");
|
|
|
615
663
|
var setup_default = { run };
|
|
616
664
|
async function migrateProjectsCliVersion() {
|
|
617
665
|
try {
|
|
618
|
-
const projectsDir =
|
|
619
|
-
if (!
|
|
666
|
+
const projectsDir = import_path4.default.join(import_os3.default.homedir(), ".prjct-cli", "projects");
|
|
667
|
+
if (!import_fs2.default.existsSync(projectsDir)) {
|
|
620
668
|
return;
|
|
621
669
|
}
|
|
622
|
-
const projectDirs =
|
|
670
|
+
const projectDirs = import_fs2.default.readdirSync(projectsDir, { withFileTypes: true }).filter((dirent) => dirent.isDirectory()).map((dirent) => dirent.name);
|
|
623
671
|
let migrated = 0;
|
|
624
672
|
for (const projectId of projectDirs) {
|
|
625
|
-
const projectJsonPath =
|
|
626
|
-
if (!
|
|
673
|
+
const projectJsonPath = import_path4.default.join(projectsDir, projectId, "project.json");
|
|
674
|
+
if (!import_fs2.default.existsSync(projectJsonPath)) {
|
|
627
675
|
continue;
|
|
628
676
|
}
|
|
629
677
|
try {
|
|
630
|
-
const content =
|
|
678
|
+
const content = import_fs2.default.readFileSync(projectJsonPath, "utf8");
|
|
631
679
|
const project = JSON.parse(content);
|
|
632
|
-
if (project.cliVersion !==
|
|
633
|
-
project.cliVersion =
|
|
634
|
-
|
|
680
|
+
if (project.cliVersion !== VERSION) {
|
|
681
|
+
project.cliVersion = VERSION;
|
|
682
|
+
import_fs2.default.writeFileSync(projectJsonPath, JSON.stringify(project, null, 2));
|
|
635
683
|
migrated++;
|
|
636
684
|
}
|
|
637
685
|
} catch {
|
|
638
686
|
}
|
|
639
687
|
}
|
|
640
688
|
if (migrated > 0) {
|
|
641
|
-
console.log(` ${GREEN}\u2713${NC} Updated ${migrated} project(s) to v${
|
|
689
|
+
console.log(` ${GREEN}\u2713${NC} Updated ${migrated} project(s) to v${VERSION}`);
|
|
642
690
|
}
|
|
643
691
|
} catch {
|
|
644
692
|
}
|
|
@@ -646,58 +694,58 @@ async function migrateProjectsCliVersion() {
|
|
|
646
694
|
__name(migrateProjectsCliVersion, "migrateProjectsCliVersion");
|
|
647
695
|
function ensureStatusLineSettings(settingsPath, statusLinePath) {
|
|
648
696
|
let settings = {};
|
|
649
|
-
if (
|
|
697
|
+
if (import_fs2.default.existsSync(settingsPath)) {
|
|
650
698
|
try {
|
|
651
|
-
settings = JSON.parse(
|
|
699
|
+
settings = JSON.parse(import_fs2.default.readFileSync(settingsPath, "utf8"));
|
|
652
700
|
} catch {
|
|
653
701
|
}
|
|
654
702
|
}
|
|
655
703
|
settings.statusLine = { type: "command", command: statusLinePath };
|
|
656
|
-
|
|
704
|
+
import_fs2.default.writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
|
|
657
705
|
}
|
|
658
706
|
__name(ensureStatusLineSettings, "ensureStatusLineSettings");
|
|
659
707
|
async function installStatusLine() {
|
|
660
708
|
try {
|
|
661
|
-
const claudeDir =
|
|
662
|
-
const settingsPath =
|
|
663
|
-
const claudeStatusLinePath =
|
|
664
|
-
const prjctStatusLineDir =
|
|
665
|
-
const prjctStatusLinePath =
|
|
666
|
-
const prjctThemesDir =
|
|
667
|
-
const prjctLibDir =
|
|
668
|
-
const prjctComponentsDir =
|
|
669
|
-
const prjctConfigPath =
|
|
670
|
-
const assetsDir =
|
|
671
|
-
const sourceScript =
|
|
672
|
-
const sourceThemeDir =
|
|
673
|
-
const sourceLibDir =
|
|
674
|
-
const sourceComponentsDir =
|
|
675
|
-
const sourceConfigPath =
|
|
676
|
-
if (!
|
|
677
|
-
|
|
678
|
-
}
|
|
679
|
-
if (!
|
|
680
|
-
|
|
681
|
-
}
|
|
682
|
-
if (!
|
|
683
|
-
|
|
684
|
-
}
|
|
685
|
-
if (!
|
|
686
|
-
|
|
687
|
-
}
|
|
688
|
-
if (!
|
|
689
|
-
|
|
690
|
-
}
|
|
691
|
-
if (
|
|
692
|
-
const existingContent =
|
|
709
|
+
const claudeDir = import_path4.default.join(import_os3.default.homedir(), ".claude");
|
|
710
|
+
const settingsPath = import_path4.default.join(claudeDir, "settings.json");
|
|
711
|
+
const claudeStatusLinePath = import_path4.default.join(claudeDir, "prjct-statusline.sh");
|
|
712
|
+
const prjctStatusLineDir = import_path4.default.join(import_os3.default.homedir(), ".prjct-cli", "statusline");
|
|
713
|
+
const prjctStatusLinePath = import_path4.default.join(prjctStatusLineDir, "statusline.sh");
|
|
714
|
+
const prjctThemesDir = import_path4.default.join(prjctStatusLineDir, "themes");
|
|
715
|
+
const prjctLibDir = import_path4.default.join(prjctStatusLineDir, "lib");
|
|
716
|
+
const prjctComponentsDir = import_path4.default.join(prjctStatusLineDir, "components");
|
|
717
|
+
const prjctConfigPath = import_path4.default.join(prjctStatusLineDir, "config.json");
|
|
718
|
+
const assetsDir = import_path4.default.join(getPackageRoot(), "assets", "statusline");
|
|
719
|
+
const sourceScript = import_path4.default.join(assetsDir, "statusline.sh");
|
|
720
|
+
const sourceThemeDir = import_path4.default.join(assetsDir, "themes");
|
|
721
|
+
const sourceLibDir = import_path4.default.join(assetsDir, "lib");
|
|
722
|
+
const sourceComponentsDir = import_path4.default.join(assetsDir, "components");
|
|
723
|
+
const sourceConfigPath = import_path4.default.join(assetsDir, "default-config.json");
|
|
724
|
+
if (!import_fs2.default.existsSync(claudeDir)) {
|
|
725
|
+
import_fs2.default.mkdirSync(claudeDir, { recursive: true });
|
|
726
|
+
}
|
|
727
|
+
if (!import_fs2.default.existsSync(prjctStatusLineDir)) {
|
|
728
|
+
import_fs2.default.mkdirSync(prjctStatusLineDir, { recursive: true });
|
|
729
|
+
}
|
|
730
|
+
if (!import_fs2.default.existsSync(prjctThemesDir)) {
|
|
731
|
+
import_fs2.default.mkdirSync(prjctThemesDir, { recursive: true });
|
|
732
|
+
}
|
|
733
|
+
if (!import_fs2.default.existsSync(prjctLibDir)) {
|
|
734
|
+
import_fs2.default.mkdirSync(prjctLibDir, { recursive: true });
|
|
735
|
+
}
|
|
736
|
+
if (!import_fs2.default.existsSync(prjctComponentsDir)) {
|
|
737
|
+
import_fs2.default.mkdirSync(prjctComponentsDir, { recursive: true });
|
|
738
|
+
}
|
|
739
|
+
if (import_fs2.default.existsSync(prjctStatusLinePath)) {
|
|
740
|
+
const existingContent = import_fs2.default.readFileSync(prjctStatusLinePath, "utf8");
|
|
693
741
|
if (existingContent.includes("CLI_VERSION=")) {
|
|
694
742
|
const versionMatch = existingContent.match(/CLI_VERSION="([^"]*)"/);
|
|
695
|
-
if (versionMatch && versionMatch[1] !==
|
|
743
|
+
if (versionMatch && versionMatch[1] !== VERSION) {
|
|
696
744
|
const updatedContent = existingContent.replace(
|
|
697
745
|
/CLI_VERSION="[^"]*"/,
|
|
698
|
-
`CLI_VERSION="${
|
|
746
|
+
`CLI_VERSION="${VERSION}"`
|
|
699
747
|
);
|
|
700
|
-
|
|
748
|
+
import_fs2.default.writeFileSync(prjctStatusLinePath, updatedContent, { mode: 493 });
|
|
701
749
|
}
|
|
702
750
|
installStatusLineModules(sourceLibDir, prjctLibDir);
|
|
703
751
|
installStatusLineModules(sourceComponentsDir, prjctComponentsDir);
|
|
@@ -706,30 +754,30 @@ async function installStatusLine() {
|
|
|
706
754
|
return;
|
|
707
755
|
}
|
|
708
756
|
}
|
|
709
|
-
if (
|
|
710
|
-
let scriptContent =
|
|
757
|
+
if (import_fs2.default.existsSync(sourceScript)) {
|
|
758
|
+
let scriptContent = import_fs2.default.readFileSync(sourceScript, "utf8");
|
|
711
759
|
scriptContent = scriptContent.replace(
|
|
712
760
|
/CLI_VERSION="[^"]*"/,
|
|
713
|
-
`CLI_VERSION="${
|
|
761
|
+
`CLI_VERSION="${VERSION}"`
|
|
714
762
|
);
|
|
715
|
-
|
|
763
|
+
import_fs2.default.writeFileSync(prjctStatusLinePath, scriptContent, { mode: 493 });
|
|
716
764
|
installStatusLineModules(sourceLibDir, prjctLibDir);
|
|
717
765
|
installStatusLineModules(sourceComponentsDir, prjctComponentsDir);
|
|
718
|
-
if (
|
|
719
|
-
const themes =
|
|
766
|
+
if (import_fs2.default.existsSync(sourceThemeDir)) {
|
|
767
|
+
const themes = import_fs2.default.readdirSync(sourceThemeDir);
|
|
720
768
|
for (const theme of themes) {
|
|
721
|
-
const src =
|
|
722
|
-
const dest =
|
|
723
|
-
|
|
769
|
+
const src = import_path4.default.join(sourceThemeDir, theme);
|
|
770
|
+
const dest = import_path4.default.join(prjctThemesDir, theme);
|
|
771
|
+
import_fs2.default.copyFileSync(src, dest);
|
|
724
772
|
}
|
|
725
773
|
}
|
|
726
|
-
if (!
|
|
727
|
-
|
|
774
|
+
if (!import_fs2.default.existsSync(prjctConfigPath) && import_fs2.default.existsSync(sourceConfigPath)) {
|
|
775
|
+
import_fs2.default.copyFileSync(sourceConfigPath, prjctConfigPath);
|
|
728
776
|
}
|
|
729
777
|
} else {
|
|
730
778
|
const scriptContent = `#!/bin/bash
|
|
731
779
|
# prjct Status Line for Claude Code
|
|
732
|
-
CLI_VERSION="${
|
|
780
|
+
CLI_VERSION="${VERSION}"
|
|
733
781
|
input=$(cat)
|
|
734
782
|
CWD=$(echo "$input" | jq -r '.workspace.current_dir // "~"' 2>/dev/null)
|
|
735
783
|
CONFIG="$CWD/.prjct/prjct.config.json"
|
|
@@ -759,7 +807,7 @@ if [ -f "$CONFIG" ]; then
|
|
|
759
807
|
fi
|
|
760
808
|
echo "prjct"
|
|
761
809
|
`;
|
|
762
|
-
|
|
810
|
+
import_fs2.default.writeFileSync(prjctStatusLinePath, scriptContent, { mode: 493 });
|
|
763
811
|
}
|
|
764
812
|
ensureStatusLineSymlink(claudeStatusLinePath, prjctStatusLinePath);
|
|
765
813
|
ensureStatusLineSettings(settingsPath, claudeStatusLinePath);
|
|
@@ -768,38 +816,38 @@ echo "prjct"
|
|
|
768
816
|
}
|
|
769
817
|
__name(installStatusLine, "installStatusLine");
|
|
770
818
|
function installStatusLineModules(sourceDir, destDir) {
|
|
771
|
-
if (!
|
|
819
|
+
if (!import_fs2.default.existsSync(sourceDir)) {
|
|
772
820
|
return;
|
|
773
821
|
}
|
|
774
|
-
const files =
|
|
822
|
+
const files = import_fs2.default.readdirSync(sourceDir);
|
|
775
823
|
for (const file of files) {
|
|
776
824
|
if (file.endsWith(".sh")) {
|
|
777
|
-
const src =
|
|
778
|
-
const dest =
|
|
779
|
-
|
|
780
|
-
|
|
825
|
+
const src = import_path4.default.join(sourceDir, file);
|
|
826
|
+
const dest = import_path4.default.join(destDir, file);
|
|
827
|
+
import_fs2.default.copyFileSync(src, dest);
|
|
828
|
+
import_fs2.default.chmodSync(dest, 493);
|
|
781
829
|
}
|
|
782
830
|
}
|
|
783
831
|
}
|
|
784
832
|
__name(installStatusLineModules, "installStatusLineModules");
|
|
785
833
|
function ensureStatusLineSymlink(linkPath, targetPath) {
|
|
786
834
|
try {
|
|
787
|
-
if (
|
|
788
|
-
const stats =
|
|
835
|
+
if (import_fs2.default.existsSync(linkPath)) {
|
|
836
|
+
const stats = import_fs2.default.lstatSync(linkPath);
|
|
789
837
|
if (stats.isSymbolicLink()) {
|
|
790
|
-
const existingTarget =
|
|
838
|
+
const existingTarget = import_fs2.default.readlinkSync(linkPath);
|
|
791
839
|
if (existingTarget === targetPath) {
|
|
792
840
|
return;
|
|
793
841
|
}
|
|
794
842
|
}
|
|
795
|
-
|
|
843
|
+
import_fs2.default.unlinkSync(linkPath);
|
|
796
844
|
}
|
|
797
|
-
|
|
845
|
+
import_fs2.default.symlinkSync(targetPath, linkPath);
|
|
798
846
|
} catch {
|
|
799
847
|
try {
|
|
800
|
-
if (
|
|
801
|
-
|
|
802
|
-
|
|
848
|
+
if (import_fs2.default.existsSync(targetPath)) {
|
|
849
|
+
import_fs2.default.copyFileSync(targetPath, linkPath);
|
|
850
|
+
import_fs2.default.chmodSync(linkPath, 493);
|
|
803
851
|
}
|
|
804
852
|
} catch {
|
|
805
853
|
}
|
package/package.json
CHANGED
|
@@ -1,39 +1,63 @@
|
|
|
1
1
|
---
|
|
2
|
-
allowed-tools: [Bash, Read, Write]
|
|
3
|
-
description: '
|
|
2
|
+
allowed-tools: [Bash, Read, Write, Glob]
|
|
3
|
+
description: 'Force update prjct-cli - sync all templates from npm package'
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# p. update - Update prjct-cli
|
|
6
|
+
# p. update - Force Update prjct-cli
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Manually sync all templates from npm package to local installation.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Step 1: Find npm package location
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
4. Updates project versions
|
|
12
|
+
```bash
|
|
13
|
+
npm root -g
|
|
14
|
+
```
|
|
16
15
|
|
|
17
|
-
|
|
16
|
+
Save this path as `NPM_ROOT`.
|
|
18
17
|
|
|
19
|
-
|
|
18
|
+
## Step 2: Copy p.md router
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
Read: `{NPM_ROOT}/prjct-cli/templates/commands/p.md`
|
|
21
|
+
Write to: `~/.claude/commands/p.md`
|
|
22
|
+
|
|
23
|
+
## Step 3: Copy ALL command templates
|
|
24
|
+
|
|
25
|
+
For each `.md` file in `{NPM_ROOT}/prjct-cli/templates/commands/`:
|
|
26
|
+
- Read the file
|
|
27
|
+
- Write to `~/.claude/commands/p/{filename}`
|
|
28
|
+
|
|
29
|
+
## Step 4: Update CLAUDE.md
|
|
24
30
|
|
|
25
|
-
|
|
31
|
+
Read: `{NPM_ROOT}/prjct-cli/templates/global/CLAUDE.md`
|
|
32
|
+
|
|
33
|
+
Check if `~/.claude/CLAUDE.md` exists:
|
|
34
|
+
- If NOT exists: Write the template content directly
|
|
35
|
+
- If exists: Find markers `<!-- prjct:start -->` and `<!-- prjct:end -->`, replace content between them
|
|
36
|
+
|
|
37
|
+
## Step 5: Copy statusline
|
|
38
|
+
|
|
39
|
+
Copy from `{NPM_ROOT}/prjct-cli/assets/statusline/` to `~/.prjct-cli/statusline/`:
|
|
40
|
+
- `statusline.sh`
|
|
41
|
+
- `lib/*.sh`
|
|
42
|
+
- `components/*.sh`
|
|
43
|
+
- `themes/*.json`
|
|
44
|
+
|
|
45
|
+
## Step 6: Get version and confirm
|
|
26
46
|
|
|
27
47
|
```bash
|
|
28
|
-
|
|
48
|
+
cat "$(npm root -g)/prjct-cli/package.json" | grep '"version"'
|
|
29
49
|
```
|
|
30
50
|
|
|
31
51
|
## Output
|
|
32
52
|
|
|
33
53
|
```
|
|
34
|
-
|
|
54
|
+
✅ prjct-cli updated
|
|
35
55
|
|
|
36
|
-
Commands:
|
|
37
|
-
|
|
38
|
-
|
|
56
|
+
Commands: synced to ~/.claude/commands/p/
|
|
57
|
+
Config: ~/.claude/CLAUDE.md updated
|
|
58
|
+
Statusline: ~/.prjct-cli/statusline/ updated
|
|
39
59
|
```
|
|
60
|
+
|
|
61
|
+
## Action
|
|
62
|
+
|
|
63
|
+
NOW execute steps 1-6 in order. Use Bash to find npm root, then Read/Write to copy files.
|