@programinglive/dev-workflow-mcp-server 1.12.0 → 1.12.1
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/package.json +1 -1
- package/workflow-state.js +33 -24
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@programinglive/dev-workflow-mcp-server",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.1",
|
|
4
4
|
"description": "MCP server to enforce development workflow discipline",
|
|
5
5
|
"homepage": "https://devworkflow.programinglive.com/",
|
|
6
6
|
"mcpName": "io.github.programinglive/dev-workflow-mcp-server",
|
package/workflow-state.js
CHANGED
|
@@ -457,6 +457,35 @@ export function resolveHistoryFile(stateFilePath) {
|
|
|
457
457
|
return inUserTree ? path.join(dir, STATE_FILENAME) : resolved;
|
|
458
458
|
}
|
|
459
459
|
|
|
460
|
+
/**
|
|
461
|
+
* Induk direktori `.state` untuk sebuah berkas state.
|
|
462
|
+
*
|
|
463
|
+
* Dulu ini dihitung dengan empat `dirname` berurutan, yang hanya benar selama
|
|
464
|
+
* tata letaknya tepat `<root>/.state/users/<user>/<berkas>`. Begitu kedalaman
|
|
465
|
+
* berubah (mis. state sesi ditaruh di subdirektori), angka itu diam-diam
|
|
466
|
+
* menghasilkan root yang salah dan baris database tercatat di proyek lain.
|
|
467
|
+
*
|
|
468
|
+
* Sekarang dicari dengan sengaja: naik sampai menemukan direktori `.state`,
|
|
469
|
+
* lalu ambil induknya. Tidak bergantung pada kedalaman.
|
|
470
|
+
*/
|
|
471
|
+
export function resolveProjectRootForState(stateFilePath) {
|
|
472
|
+
const resolved = path.resolve(stateFilePath);
|
|
473
|
+
let current = path.dirname(resolved);
|
|
474
|
+
|
|
475
|
+
for (;;) {
|
|
476
|
+
if (path.basename(current) === STATE_DIR) {
|
|
477
|
+
return path.dirname(current);
|
|
478
|
+
}
|
|
479
|
+
const parent = path.dirname(current);
|
|
480
|
+
if (parent === current) break;
|
|
481
|
+
current = parent;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
// Di luar tata letak `.state` (mis. path eksplisit untuk tes): pakai
|
|
485
|
+
// direktori yang memuat berkasnya.
|
|
486
|
+
return path.dirname(resolved);
|
|
487
|
+
}
|
|
488
|
+
|
|
460
489
|
export function resolveStateFile() {
|
|
461
490
|
const customPath = process.env.DEV_WORKFLOW_STATE_FILE;
|
|
462
491
|
if (customPath) {
|
|
@@ -785,30 +814,10 @@ export class WorkflowState {
|
|
|
785
814
|
try {
|
|
786
815
|
const { insertHistoryEntry, updateSummaryForUser, saveState } = await import("./db/index.js");
|
|
787
816
|
const userId = getCurrentUserId();
|
|
788
|
-
//
|
|
789
|
-
//
|
|
790
|
-
//
|
|
791
|
-
|
|
792
|
-
// A safe bet that is unique per project on this machine is the project root found by resolveStateFile.
|
|
793
|
-
// Let's perform a simple resolution:
|
|
794
|
-
|
|
795
|
-
const stateDir = path.dirname(path.dirname(path.dirname(this.stateFile)));
|
|
796
|
-
// stateFile = <root>/.state/users/<user>/workflow-state.json
|
|
797
|
-
// dirname = <root>/.state/users/<user>
|
|
798
|
-
// dirname = <root>/.state/users
|
|
799
|
-
// dirname = <root>/.state
|
|
800
|
-
// dirname = <root>
|
|
801
|
-
|
|
802
|
-
// Wait, let's look at the path structure from resolveStateFile:
|
|
803
|
-
// path.join(userDir, STATE_FILENAME); where userDir is path.join(stateDir, "users", userId);
|
|
804
|
-
// and stateDir is path.join(projectRoot, STATE_DIR);
|
|
805
|
-
// So: projectRoot/.state/users/userId/workflow-state.json
|
|
806
|
-
// 1. dirname -> .../userId
|
|
807
|
-
// 2. dirname -> .../users
|
|
808
|
-
// 3. dirname -> .../.state
|
|
809
|
-
// 4. dirname -> .../projectRoot
|
|
810
|
-
|
|
811
|
-
const projectRoot = path.dirname(path.dirname(path.dirname(path.dirname(this.stateFile))));
|
|
817
|
+
// projectRoot dipakai sebagai identitas proyek di database. Ditentukan
|
|
818
|
+
// lewat resolveProjectRootForState, bukan dengan menghitung `dirname`
|
|
819
|
+
// berkali-kali: jumlah itu hanya benar untuk satu kedalaman tertentu.
|
|
820
|
+
const projectRoot = resolveProjectRootForState(this.stateFile);
|
|
812
821
|
|
|
813
822
|
for (const entry of this.state.history || []) {
|
|
814
823
|
await insertHistoryEntry(userId, projectRoot, entry);
|