prjct-cli 0.33.5 → 0.35.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 +65 -0
- package/core/agentic/command-executor.ts +26 -4
- package/core/agentic/index.ts +1 -0
- package/core/agentic/template-executor.ts +261 -0
- package/core/commands/workflow.ts +28 -6
- package/core/schemas/state.ts +43 -1
- package/core/services/agent-service.ts +36 -45
- package/core/storage/state-storage.ts +259 -1
- package/core/types/agentic.ts +6 -0
- package/dist/bin/prjct.mjs +1320 -523
- package/dist/core/infrastructure/command-installer.js +45 -19
- package/dist/core/infrastructure/editors-config.js +1 -1
- package/dist/core/infrastructure/setup.js +111 -70
- package/dist/core/utils/version.js +1 -1
- package/package.json +1 -1
- package/scripts/postinstall.js +26 -2
- package/templates/agentic/orchestrator.md +402 -0
- package/templates/agentic/task-fragmentation.md +323 -0
- package/templates/commands/bug.md +2 -0
- package/templates/commands/github.md +63 -7
- package/templates/commands/jira.md +44 -4
- package/templates/commands/linear.md +40 -8
- package/templates/commands/monday.md +42 -6
- package/templates/commands/p.md +57 -10
- package/templates/commands/sync.md +133 -97
- package/templates/commands/task.md +12 -0
- package/templates/config/skill-mappings.json +95 -63
- package/packages/shared/.turbo/turbo-build.log +0 -14
- package/packages/shared/dist/index.d.ts +0 -10
- package/packages/shared/dist/index.d.ts.map +0 -1
- package/packages/shared/dist/index.js +0 -4196
- package/packages/shared/dist/schemas.d.ts +0 -408
- package/packages/shared/dist/schemas.d.ts.map +0 -1
- package/packages/shared/dist/types.d.ts +0 -144
- package/packages/shared/dist/types.d.ts.map +0 -1
- package/packages/shared/dist/unified.d.ts +0 -139
- package/packages/shared/dist/unified.d.ts.map +0 -1
- package/packages/shared/dist/utils.d.ts +0 -60
- package/packages/shared/dist/utils.d.ts.map +0 -1
- package/templates/commands/ask.md +0 -128
- package/templates/commands/dashboard.md +0 -686
- package/templates/commands/feature.md +0 -46
- package/templates/commands/now.md +0 -53
- package/templates/commands/suggest.md +0 -116
- package/templates/global/docs/agents.md +0 -88
- package/templates/global/docs/architecture.md +0 -103
- package/templates/global/docs/commands.md +0 -96
- package/templates/global/docs/validation.md +0 -95
|
@@ -61,7 +61,7 @@ function getPackageRoot() {
|
|
|
61
61
|
cachedPackageRoot = currentDir;
|
|
62
62
|
return currentDir;
|
|
63
63
|
}
|
|
64
|
-
} catch {
|
|
64
|
+
} catch (_error) {
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
currentDir = import_path.default.dirname(currentDir);
|
|
@@ -89,6 +89,12 @@ __name(getVersion, "getVersion");
|
|
|
89
89
|
var VERSION = getVersion();
|
|
90
90
|
var PACKAGE_ROOT = getPackageRoot();
|
|
91
91
|
|
|
92
|
+
// core/types/fs.ts
|
|
93
|
+
function isNotFoundError(error) {
|
|
94
|
+
return error?.code === "ENOENT";
|
|
95
|
+
}
|
|
96
|
+
__name(isNotFoundError, "isNotFoundError");
|
|
97
|
+
|
|
92
98
|
// core/infrastructure/command-installer.ts
|
|
93
99
|
async function installDocs() {
|
|
94
100
|
try {
|
|
@@ -130,8 +136,12 @@ async function installGlobalConfig(claudeConfigPath, detectClaude) {
|
|
|
130
136
|
try {
|
|
131
137
|
existingContent = await import_promises.default.readFile(globalConfigPath, "utf-8");
|
|
132
138
|
fileExists = true;
|
|
133
|
-
} catch {
|
|
134
|
-
|
|
139
|
+
} catch (error) {
|
|
140
|
+
if (isNotFoundError(error)) {
|
|
141
|
+
fileExists = false;
|
|
142
|
+
} else {
|
|
143
|
+
throw error;
|
|
144
|
+
}
|
|
135
145
|
}
|
|
136
146
|
if (!fileExists) {
|
|
137
147
|
await import_promises.default.writeFile(globalConfigPath, templateContent, "utf-8");
|
|
@@ -200,8 +210,11 @@ var CommandInstaller = class {
|
|
|
200
210
|
try {
|
|
201
211
|
await import_promises.default.access(this.claudeConfigPath);
|
|
202
212
|
return true;
|
|
203
|
-
} catch {
|
|
204
|
-
|
|
213
|
+
} catch (error) {
|
|
214
|
+
if (isNotFoundError(error)) {
|
|
215
|
+
return false;
|
|
216
|
+
}
|
|
217
|
+
throw error;
|
|
205
218
|
}
|
|
206
219
|
}
|
|
207
220
|
/**
|
|
@@ -211,7 +224,7 @@ var CommandInstaller = class {
|
|
|
211
224
|
try {
|
|
212
225
|
const files = await import_promises.default.readdir(this.templatesDir);
|
|
213
226
|
return files.filter((f) => f.endsWith(".md"));
|
|
214
|
-
} catch {
|
|
227
|
+
} catch (error) {
|
|
215
228
|
return [
|
|
216
229
|
"init.md",
|
|
217
230
|
"now.md",
|
|
@@ -297,7 +310,7 @@ var CommandInstaller = class {
|
|
|
297
310
|
}
|
|
298
311
|
try {
|
|
299
312
|
await import_promises.default.rmdir(this.claudeCommandsPath);
|
|
300
|
-
} catch {
|
|
313
|
+
} catch (error) {
|
|
301
314
|
}
|
|
302
315
|
return {
|
|
303
316
|
success: true,
|
|
@@ -332,12 +345,15 @@ var CommandInstaller = class {
|
|
|
332
345
|
commands: installedCommands,
|
|
333
346
|
path: this.claudeCommandsPath
|
|
334
347
|
};
|
|
335
|
-
} catch {
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
348
|
+
} catch (error) {
|
|
349
|
+
if (isNotFoundError(error)) {
|
|
350
|
+
return {
|
|
351
|
+
installed: false,
|
|
352
|
+
claudeDetected: true,
|
|
353
|
+
commands: []
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
throw error;
|
|
341
357
|
}
|
|
342
358
|
}
|
|
343
359
|
/**
|
|
@@ -371,8 +387,11 @@ var CommandInstaller = class {
|
|
|
371
387
|
const templatePath = import_path2.default.join(this.templatesDir, `${commandName}.md`);
|
|
372
388
|
await import_promises.default.access(templatePath);
|
|
373
389
|
return true;
|
|
374
|
-
} catch {
|
|
375
|
-
|
|
390
|
+
} catch (error) {
|
|
391
|
+
if (isNotFoundError(error)) {
|
|
392
|
+
return false;
|
|
393
|
+
}
|
|
394
|
+
throw error;
|
|
376
395
|
}
|
|
377
396
|
}
|
|
378
397
|
/**
|
|
@@ -387,8 +406,11 @@ var CommandInstaller = class {
|
|
|
387
406
|
const content = await import_promises.default.readFile(routerSource, "utf-8");
|
|
388
407
|
await import_promises.default.writeFile(routerDest, content, "utf-8");
|
|
389
408
|
return true;
|
|
390
|
-
} catch {
|
|
391
|
-
|
|
409
|
+
} catch (error) {
|
|
410
|
+
if (isNotFoundError(error)) {
|
|
411
|
+
return false;
|
|
412
|
+
}
|
|
413
|
+
throw error;
|
|
392
414
|
}
|
|
393
415
|
}
|
|
394
416
|
/**
|
|
@@ -413,8 +435,12 @@ var CommandInstaller = class {
|
|
|
413
435
|
try {
|
|
414
436
|
installedFiles = await import_promises.default.readdir(this.claudeCommandsPath);
|
|
415
437
|
installedFiles = installedFiles.filter((f) => f.endsWith(".md"));
|
|
416
|
-
} catch {
|
|
417
|
-
|
|
438
|
+
} catch (error) {
|
|
439
|
+
if (isNotFoundError(error)) {
|
|
440
|
+
installedFiles = [];
|
|
441
|
+
} else {
|
|
442
|
+
throw error;
|
|
443
|
+
}
|
|
418
444
|
}
|
|
419
445
|
const results = {
|
|
420
446
|
success: true,
|
|
@@ -36,7 +36,7 @@ __export(setup_exports, {
|
|
|
36
36
|
});
|
|
37
37
|
module.exports = __toCommonJS(setup_exports);
|
|
38
38
|
var import_child_process = require("child_process");
|
|
39
|
-
var
|
|
39
|
+
var import_fs3 = __toESM(require("fs"));
|
|
40
40
|
var import_path4 = __toESM(require("path"));
|
|
41
41
|
var import_os3 = __toESM(require("os"));
|
|
42
42
|
|
|
@@ -65,7 +65,7 @@ function getPackageRoot() {
|
|
|
65
65
|
cachedPackageRoot = currentDir;
|
|
66
66
|
return currentDir;
|
|
67
67
|
}
|
|
68
|
-
} catch {
|
|
68
|
+
} catch (_error) {
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
currentDir = import_path.default.dirname(currentDir);
|
|
@@ -93,6 +93,12 @@ __name(getVersion, "getVersion");
|
|
|
93
93
|
var VERSION = getVersion();
|
|
94
94
|
var PACKAGE_ROOT = getPackageRoot();
|
|
95
95
|
|
|
96
|
+
// core/types/fs.ts
|
|
97
|
+
function isNotFoundError(error) {
|
|
98
|
+
return error?.code === "ENOENT";
|
|
99
|
+
}
|
|
100
|
+
__name(isNotFoundError, "isNotFoundError");
|
|
101
|
+
|
|
96
102
|
// core/infrastructure/command-installer.ts
|
|
97
103
|
async function installDocs() {
|
|
98
104
|
try {
|
|
@@ -134,8 +140,12 @@ async function installGlobalConfig(claudeConfigPath, detectClaude) {
|
|
|
134
140
|
try {
|
|
135
141
|
existingContent = await import_promises.default.readFile(globalConfigPath, "utf-8");
|
|
136
142
|
fileExists = true;
|
|
137
|
-
} catch {
|
|
138
|
-
|
|
143
|
+
} catch (error) {
|
|
144
|
+
if (isNotFoundError(error)) {
|
|
145
|
+
fileExists = false;
|
|
146
|
+
} else {
|
|
147
|
+
throw error;
|
|
148
|
+
}
|
|
139
149
|
}
|
|
140
150
|
if (!fileExists) {
|
|
141
151
|
await import_promises.default.writeFile(globalConfigPath, templateContent, "utf-8");
|
|
@@ -204,8 +214,11 @@ var CommandInstaller = class {
|
|
|
204
214
|
try {
|
|
205
215
|
await import_promises.default.access(this.claudeConfigPath);
|
|
206
216
|
return true;
|
|
207
|
-
} catch {
|
|
208
|
-
|
|
217
|
+
} catch (error) {
|
|
218
|
+
if (isNotFoundError(error)) {
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
221
|
+
throw error;
|
|
209
222
|
}
|
|
210
223
|
}
|
|
211
224
|
/**
|
|
@@ -215,7 +228,7 @@ var CommandInstaller = class {
|
|
|
215
228
|
try {
|
|
216
229
|
const files = await import_promises.default.readdir(this.templatesDir);
|
|
217
230
|
return files.filter((f) => f.endsWith(".md"));
|
|
218
|
-
} catch {
|
|
231
|
+
} catch (error) {
|
|
219
232
|
return [
|
|
220
233
|
"init.md",
|
|
221
234
|
"now.md",
|
|
@@ -301,7 +314,7 @@ var CommandInstaller = class {
|
|
|
301
314
|
}
|
|
302
315
|
try {
|
|
303
316
|
await import_promises.default.rmdir(this.claudeCommandsPath);
|
|
304
|
-
} catch {
|
|
317
|
+
} catch (error) {
|
|
305
318
|
}
|
|
306
319
|
return {
|
|
307
320
|
success: true,
|
|
@@ -336,12 +349,15 @@ var CommandInstaller = class {
|
|
|
336
349
|
commands: installedCommands,
|
|
337
350
|
path: this.claudeCommandsPath
|
|
338
351
|
};
|
|
339
|
-
} catch {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
352
|
+
} catch (error) {
|
|
353
|
+
if (isNotFoundError(error)) {
|
|
354
|
+
return {
|
|
355
|
+
installed: false,
|
|
356
|
+
claudeDetected: true,
|
|
357
|
+
commands: []
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
throw error;
|
|
345
361
|
}
|
|
346
362
|
}
|
|
347
363
|
/**
|
|
@@ -375,8 +391,11 @@ var CommandInstaller = class {
|
|
|
375
391
|
const templatePath = import_path2.default.join(this.templatesDir, `${commandName}.md`);
|
|
376
392
|
await import_promises.default.access(templatePath);
|
|
377
393
|
return true;
|
|
378
|
-
} catch {
|
|
379
|
-
|
|
394
|
+
} catch (error) {
|
|
395
|
+
if (isNotFoundError(error)) {
|
|
396
|
+
return false;
|
|
397
|
+
}
|
|
398
|
+
throw error;
|
|
380
399
|
}
|
|
381
400
|
}
|
|
382
401
|
/**
|
|
@@ -391,8 +410,11 @@ var CommandInstaller = class {
|
|
|
391
410
|
const content = await import_promises.default.readFile(routerSource, "utf-8");
|
|
392
411
|
await import_promises.default.writeFile(routerDest, content, "utf-8");
|
|
393
412
|
return true;
|
|
394
|
-
} catch {
|
|
395
|
-
|
|
413
|
+
} catch (error) {
|
|
414
|
+
if (isNotFoundError(error)) {
|
|
415
|
+
return false;
|
|
416
|
+
}
|
|
417
|
+
throw error;
|
|
396
418
|
}
|
|
397
419
|
}
|
|
398
420
|
/**
|
|
@@ -417,8 +439,12 @@ var CommandInstaller = class {
|
|
|
417
439
|
try {
|
|
418
440
|
installedFiles = await import_promises.default.readdir(this.claudeCommandsPath);
|
|
419
441
|
installedFiles = installedFiles.filter((f) => f.endsWith(".md"));
|
|
420
|
-
} catch {
|
|
421
|
-
|
|
442
|
+
} catch (error) {
|
|
443
|
+
if (isNotFoundError(error)) {
|
|
444
|
+
installedFiles = [];
|
|
445
|
+
} else {
|
|
446
|
+
throw error;
|
|
447
|
+
}
|
|
422
448
|
}
|
|
423
449
|
const results = {
|
|
424
450
|
success: true,
|
|
@@ -569,7 +595,7 @@ var EditorsConfig = class {
|
|
|
569
595
|
try {
|
|
570
596
|
await import_promises2.default.access(this.configFile);
|
|
571
597
|
return true;
|
|
572
|
-
} catch {
|
|
598
|
+
} catch (_error) {
|
|
573
599
|
return false;
|
|
574
600
|
}
|
|
575
601
|
}
|
|
@@ -602,7 +628,7 @@ async function hasClaudeCodeCLI() {
|
|
|
602
628
|
try {
|
|
603
629
|
(0, import_child_process.execSync)("which claude", { stdio: "ignore" });
|
|
604
630
|
return true;
|
|
605
|
-
} catch {
|
|
631
|
+
} catch (_error) {
|
|
606
632
|
return false;
|
|
607
633
|
}
|
|
608
634
|
}
|
|
@@ -664,44 +690,53 @@ var setup_default = { run };
|
|
|
664
690
|
async function migrateProjectsCliVersion() {
|
|
665
691
|
try {
|
|
666
692
|
const projectsDir = import_path4.default.join(import_os3.default.homedir(), ".prjct-cli", "projects");
|
|
667
|
-
if (!
|
|
693
|
+
if (!import_fs3.default.existsSync(projectsDir)) {
|
|
668
694
|
return;
|
|
669
695
|
}
|
|
670
|
-
const projectDirs =
|
|
696
|
+
const projectDirs = import_fs3.default.readdirSync(projectsDir, { withFileTypes: true }).filter((dirent) => dirent.isDirectory()).map((dirent) => dirent.name);
|
|
671
697
|
let migrated = 0;
|
|
672
698
|
for (const projectId of projectDirs) {
|
|
673
699
|
const projectJsonPath = import_path4.default.join(projectsDir, projectId, "project.json");
|
|
674
|
-
if (!
|
|
700
|
+
if (!import_fs3.default.existsSync(projectJsonPath)) {
|
|
675
701
|
continue;
|
|
676
702
|
}
|
|
677
703
|
try {
|
|
678
|
-
const content =
|
|
704
|
+
const content = import_fs3.default.readFileSync(projectJsonPath, "utf8");
|
|
679
705
|
const project = JSON.parse(content);
|
|
680
706
|
if (project.cliVersion !== VERSION) {
|
|
681
707
|
project.cliVersion = VERSION;
|
|
682
|
-
|
|
708
|
+
import_fs3.default.writeFileSync(projectJsonPath, JSON.stringify(project, null, 2));
|
|
683
709
|
migrated++;
|
|
684
710
|
}
|
|
685
|
-
} catch {
|
|
711
|
+
} catch (error) {
|
|
712
|
+
if (!isNotFoundError(error) && !(error instanceof SyntaxError)) {
|
|
713
|
+
throw error;
|
|
714
|
+
}
|
|
686
715
|
}
|
|
687
716
|
}
|
|
688
717
|
if (migrated > 0) {
|
|
689
718
|
console.log(` ${GREEN}\u2713${NC} Updated ${migrated} project(s) to v${VERSION}`);
|
|
690
719
|
}
|
|
691
|
-
} catch {
|
|
720
|
+
} catch (error) {
|
|
721
|
+
if (!isNotFoundError(error)) {
|
|
722
|
+
console.error(`Migration warning: ${error.message}`);
|
|
723
|
+
}
|
|
692
724
|
}
|
|
693
725
|
}
|
|
694
726
|
__name(migrateProjectsCliVersion, "migrateProjectsCliVersion");
|
|
695
727
|
function ensureStatusLineSettings(settingsPath, statusLinePath) {
|
|
696
728
|
let settings = {};
|
|
697
|
-
if (
|
|
729
|
+
if (import_fs3.default.existsSync(settingsPath)) {
|
|
698
730
|
try {
|
|
699
|
-
settings = JSON.parse(
|
|
700
|
-
} catch {
|
|
731
|
+
settings = JSON.parse(import_fs3.default.readFileSync(settingsPath, "utf8"));
|
|
732
|
+
} catch (error) {
|
|
733
|
+
if (!(error instanceof SyntaxError)) {
|
|
734
|
+
throw error;
|
|
735
|
+
}
|
|
701
736
|
}
|
|
702
737
|
}
|
|
703
738
|
settings.statusLine = { type: "command", command: statusLinePath };
|
|
704
|
-
|
|
739
|
+
import_fs3.default.writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
|
|
705
740
|
}
|
|
706
741
|
__name(ensureStatusLineSettings, "ensureStatusLineSettings");
|
|
707
742
|
async function installStatusLine() {
|
|
@@ -721,23 +756,23 @@ async function installStatusLine() {
|
|
|
721
756
|
const sourceLibDir = import_path4.default.join(assetsDir, "lib");
|
|
722
757
|
const sourceComponentsDir = import_path4.default.join(assetsDir, "components");
|
|
723
758
|
const sourceConfigPath = import_path4.default.join(assetsDir, "default-config.json");
|
|
724
|
-
if (!
|
|
725
|
-
|
|
759
|
+
if (!import_fs3.default.existsSync(claudeDir)) {
|
|
760
|
+
import_fs3.default.mkdirSync(claudeDir, { recursive: true });
|
|
726
761
|
}
|
|
727
|
-
if (!
|
|
728
|
-
|
|
762
|
+
if (!import_fs3.default.existsSync(prjctStatusLineDir)) {
|
|
763
|
+
import_fs3.default.mkdirSync(prjctStatusLineDir, { recursive: true });
|
|
729
764
|
}
|
|
730
|
-
if (!
|
|
731
|
-
|
|
765
|
+
if (!import_fs3.default.existsSync(prjctThemesDir)) {
|
|
766
|
+
import_fs3.default.mkdirSync(prjctThemesDir, { recursive: true });
|
|
732
767
|
}
|
|
733
|
-
if (!
|
|
734
|
-
|
|
768
|
+
if (!import_fs3.default.existsSync(prjctLibDir)) {
|
|
769
|
+
import_fs3.default.mkdirSync(prjctLibDir, { recursive: true });
|
|
735
770
|
}
|
|
736
|
-
if (!
|
|
737
|
-
|
|
771
|
+
if (!import_fs3.default.existsSync(prjctComponentsDir)) {
|
|
772
|
+
import_fs3.default.mkdirSync(prjctComponentsDir, { recursive: true });
|
|
738
773
|
}
|
|
739
|
-
if (
|
|
740
|
-
const existingContent =
|
|
774
|
+
if (import_fs3.default.existsSync(prjctStatusLinePath)) {
|
|
775
|
+
const existingContent = import_fs3.default.readFileSync(prjctStatusLinePath, "utf8");
|
|
741
776
|
if (existingContent.includes("CLI_VERSION=")) {
|
|
742
777
|
const versionMatch = existingContent.match(/CLI_VERSION="([^"]*)"/);
|
|
743
778
|
if (versionMatch && versionMatch[1] !== VERSION) {
|
|
@@ -745,7 +780,7 @@ async function installStatusLine() {
|
|
|
745
780
|
/CLI_VERSION="[^"]*"/,
|
|
746
781
|
`CLI_VERSION="${VERSION}"`
|
|
747
782
|
);
|
|
748
|
-
|
|
783
|
+
import_fs3.default.writeFileSync(prjctStatusLinePath, updatedContent, { mode: 493 });
|
|
749
784
|
}
|
|
750
785
|
installStatusLineModules(sourceLibDir, prjctLibDir);
|
|
751
786
|
installStatusLineModules(sourceComponentsDir, prjctComponentsDir);
|
|
@@ -754,25 +789,25 @@ async function installStatusLine() {
|
|
|
754
789
|
return;
|
|
755
790
|
}
|
|
756
791
|
}
|
|
757
|
-
if (
|
|
758
|
-
let scriptContent =
|
|
792
|
+
if (import_fs3.default.existsSync(sourceScript)) {
|
|
793
|
+
let scriptContent = import_fs3.default.readFileSync(sourceScript, "utf8");
|
|
759
794
|
scriptContent = scriptContent.replace(
|
|
760
795
|
/CLI_VERSION="[^"]*"/,
|
|
761
796
|
`CLI_VERSION="${VERSION}"`
|
|
762
797
|
);
|
|
763
|
-
|
|
798
|
+
import_fs3.default.writeFileSync(prjctStatusLinePath, scriptContent, { mode: 493 });
|
|
764
799
|
installStatusLineModules(sourceLibDir, prjctLibDir);
|
|
765
800
|
installStatusLineModules(sourceComponentsDir, prjctComponentsDir);
|
|
766
|
-
if (
|
|
767
|
-
const themes =
|
|
801
|
+
if (import_fs3.default.existsSync(sourceThemeDir)) {
|
|
802
|
+
const themes = import_fs3.default.readdirSync(sourceThemeDir);
|
|
768
803
|
for (const theme of themes) {
|
|
769
804
|
const src = import_path4.default.join(sourceThemeDir, theme);
|
|
770
805
|
const dest = import_path4.default.join(prjctThemesDir, theme);
|
|
771
|
-
|
|
806
|
+
import_fs3.default.copyFileSync(src, dest);
|
|
772
807
|
}
|
|
773
808
|
}
|
|
774
|
-
if (!
|
|
775
|
-
|
|
809
|
+
if (!import_fs3.default.existsSync(prjctConfigPath) && import_fs3.default.existsSync(sourceConfigPath)) {
|
|
810
|
+
import_fs3.default.copyFileSync(sourceConfigPath, prjctConfigPath);
|
|
776
811
|
}
|
|
777
812
|
} else {
|
|
778
813
|
const scriptContent = `#!/bin/bash
|
|
@@ -807,49 +842,55 @@ if [ -f "$CONFIG" ]; then
|
|
|
807
842
|
fi
|
|
808
843
|
echo "prjct"
|
|
809
844
|
`;
|
|
810
|
-
|
|
845
|
+
import_fs3.default.writeFileSync(prjctStatusLinePath, scriptContent, { mode: 493 });
|
|
811
846
|
}
|
|
812
847
|
ensureStatusLineSymlink(claudeStatusLinePath, prjctStatusLinePath);
|
|
813
848
|
ensureStatusLineSettings(settingsPath, claudeStatusLinePath);
|
|
814
|
-
} catch {
|
|
849
|
+
} catch (error) {
|
|
850
|
+
if (!isNotFoundError(error)) {
|
|
851
|
+
console.error(`Status line warning: ${error.message}`);
|
|
852
|
+
}
|
|
815
853
|
}
|
|
816
854
|
}
|
|
817
855
|
__name(installStatusLine, "installStatusLine");
|
|
818
856
|
function installStatusLineModules(sourceDir, destDir) {
|
|
819
|
-
if (!
|
|
857
|
+
if (!import_fs3.default.existsSync(sourceDir)) {
|
|
820
858
|
return;
|
|
821
859
|
}
|
|
822
|
-
const files =
|
|
860
|
+
const files = import_fs3.default.readdirSync(sourceDir);
|
|
823
861
|
for (const file of files) {
|
|
824
862
|
if (file.endsWith(".sh")) {
|
|
825
863
|
const src = import_path4.default.join(sourceDir, file);
|
|
826
864
|
const dest = import_path4.default.join(destDir, file);
|
|
827
|
-
|
|
828
|
-
|
|
865
|
+
import_fs3.default.copyFileSync(src, dest);
|
|
866
|
+
import_fs3.default.chmodSync(dest, 493);
|
|
829
867
|
}
|
|
830
868
|
}
|
|
831
869
|
}
|
|
832
870
|
__name(installStatusLineModules, "installStatusLineModules");
|
|
833
871
|
function ensureStatusLineSymlink(linkPath, targetPath) {
|
|
834
872
|
try {
|
|
835
|
-
if (
|
|
836
|
-
const stats =
|
|
873
|
+
if (import_fs3.default.existsSync(linkPath)) {
|
|
874
|
+
const stats = import_fs3.default.lstatSync(linkPath);
|
|
837
875
|
if (stats.isSymbolicLink()) {
|
|
838
|
-
const existingTarget =
|
|
876
|
+
const existingTarget = import_fs3.default.readlinkSync(linkPath);
|
|
839
877
|
if (existingTarget === targetPath) {
|
|
840
878
|
return;
|
|
841
879
|
}
|
|
842
880
|
}
|
|
843
|
-
|
|
881
|
+
import_fs3.default.unlinkSync(linkPath);
|
|
844
882
|
}
|
|
845
|
-
|
|
846
|
-
} catch {
|
|
883
|
+
import_fs3.default.symlinkSync(targetPath, linkPath);
|
|
884
|
+
} catch (error) {
|
|
847
885
|
try {
|
|
848
|
-
if (
|
|
849
|
-
|
|
850
|
-
|
|
886
|
+
if (import_fs3.default.existsSync(targetPath)) {
|
|
887
|
+
import_fs3.default.copyFileSync(targetPath, linkPath);
|
|
888
|
+
import_fs3.default.chmodSync(linkPath, 493);
|
|
889
|
+
}
|
|
890
|
+
} catch (copyError) {
|
|
891
|
+
if (!isNotFoundError(copyError)) {
|
|
892
|
+
console.error(`Symlink fallback warning: ${copyError.message}`);
|
|
851
893
|
}
|
|
852
|
-
} catch {
|
|
853
894
|
}
|
|
854
895
|
}
|
|
855
896
|
}
|
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -23,7 +23,7 @@ const VERSION = pkg.version
|
|
|
23
23
|
|
|
24
24
|
console.log('\n prjct-cli postinstall\n')
|
|
25
25
|
|
|
26
|
-
// 1. Copy p.md router (CRITICAL -
|
|
26
|
+
// 1. Copy p.md router (CRITICAL - main entry point)
|
|
27
27
|
try {
|
|
28
28
|
fs.mkdirSync(COMMANDS_DIR, { recursive: true })
|
|
29
29
|
|
|
@@ -41,7 +41,31 @@ try {
|
|
|
41
41
|
console.log(' Run: npx prjct-cli setup')
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
// 2.
|
|
44
|
+
// 2. Install individual commands as separate skills (p.task, p.sync, etc.)
|
|
45
|
+
try {
|
|
46
|
+
const commandsDir = path.join(ROOT, 'templates', 'commands')
|
|
47
|
+
const commands = fs.readdirSync(commandsDir).filter(f => f.endsWith('.md') && f !== 'p.md')
|
|
48
|
+
|
|
49
|
+
let installed = 0
|
|
50
|
+
for (const cmd of commands) {
|
|
51
|
+
const src = path.join(commandsDir, cmd)
|
|
52
|
+
const cmdName = cmd.replace('.md', '')
|
|
53
|
+
const dest = path.join(COMMANDS_DIR, `p.${cmdName}.md`)
|
|
54
|
+
|
|
55
|
+
try {
|
|
56
|
+
fs.copyFileSync(src, dest)
|
|
57
|
+
installed++
|
|
58
|
+
} catch {
|
|
59
|
+
// Skip files that fail to copy
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
console.log(` \u2713 ${installed} individual commands installed (/p.task, /p.sync, etc.)`)
|
|
64
|
+
} catch (error) {
|
|
65
|
+
console.log(' ! Could not install individual commands:', error.message)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// 3. Statusline (best-effort, not critical)
|
|
45
69
|
try {
|
|
46
70
|
const STATUSLINE_SRC = path.join(ROOT, 'assets', 'statusline')
|
|
47
71
|
const STATUSLINE_DEST = path.join(HOME, '.prjct-cli', 'statusline')
|