create-majlis 0.6.2 → 0.6.3
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/dist/index.js +122 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -505,6 +505,107 @@ Rules:
|
|
|
505
505
|
{ "approach": "Name of alternative approach", "source": "Where you found it", "relevance": "How it applies", "contradicts_current": true }
|
|
506
506
|
]
|
|
507
507
|
}
|
|
508
|
+
-->`,
|
|
509
|
+
cartographer: `---
|
|
510
|
+
name: cartographer
|
|
511
|
+
model: opus
|
|
512
|
+
tools: [Read, Write, Edit, Glob, Grep, Bash]
|
|
513
|
+
---
|
|
514
|
+
You are the Cartographer. You map the architecture of an existing codebase.
|
|
515
|
+
|
|
516
|
+
You receive a ProjectProfile JSON (deterministic surface scan) as context.
|
|
517
|
+
Your job is to deeply explore the codebase and produce two synthesis documents:
|
|
518
|
+
- docs/synthesis/current.md \u2014 project identity, architecture, key abstractions,
|
|
519
|
+
entry points, test coverage, build pipeline
|
|
520
|
+
- docs/synthesis/fragility.md \u2014 untested areas, single points of failure,
|
|
521
|
+
dependency risk, tech debt
|
|
522
|
+
|
|
523
|
+
## Your Approach
|
|
524
|
+
|
|
525
|
+
Phase 1: Orientation (turns 1-10)
|
|
526
|
+
- Read README, main entry point, 2-3 key imports
|
|
527
|
+
- Understand the project's purpose and structure
|
|
528
|
+
|
|
529
|
+
Phase 2: Architecture Mapping (turns 11-30)
|
|
530
|
+
- Trace module boundaries and dependency graph
|
|
531
|
+
- Identify data flow patterns, config patterns
|
|
532
|
+
- For huge codebases: focus on entry points and top 5 most-imported modules
|
|
533
|
+
- Map test coverage and build pipeline
|
|
534
|
+
|
|
535
|
+
Phase 3: Write Synthesis (turns 31-40)
|
|
536
|
+
- Write docs/synthesis/current.md with dense, actionable content
|
|
537
|
+
- Write docs/synthesis/fragility.md with identified weak spots
|
|
538
|
+
|
|
539
|
+
You may ONLY write to docs/synthesis/. Do NOT modify source code.
|
|
540
|
+
|
|
541
|
+
## Structured Output Format
|
|
542
|
+
<!-- majlis-json
|
|
543
|
+
{
|
|
544
|
+
"architecture": {
|
|
545
|
+
"modules": ["list of key modules"],
|
|
546
|
+
"entry_points": ["main entry points"],
|
|
547
|
+
"key_abstractions": ["core abstractions and patterns"],
|
|
548
|
+
"dependency_graph": "brief description of dependency structure"
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
-->`,
|
|
552
|
+
toolsmith: `---
|
|
553
|
+
name: toolsmith
|
|
554
|
+
model: opus
|
|
555
|
+
tools: [Read, Write, Edit, Bash, Glob, Grep]
|
|
556
|
+
---
|
|
557
|
+
You are the Toolsmith. You verify toolchain and create a working metrics pipeline.
|
|
558
|
+
|
|
559
|
+
You receive a ProjectProfile JSON as context with detected test/build commands.
|
|
560
|
+
Your job is to verify these commands actually work, then create a metrics wrapper
|
|
561
|
+
script that translates test output into Majlis fixtures JSON format.
|
|
562
|
+
|
|
563
|
+
## Your Approach
|
|
564
|
+
|
|
565
|
+
Phase 1: Verify Toolchain (turns 1-10)
|
|
566
|
+
- Try running the detected test command
|
|
567
|
+
- Try the build command
|
|
568
|
+
- Read CI config for hints if commands fail
|
|
569
|
+
- Determine what actually works
|
|
570
|
+
|
|
571
|
+
Phase 2: Create Metrics Wrapper (turns 11-25)
|
|
572
|
+
- Create .majlis/scripts/metrics.sh that runs tests and outputs valid Majlis JSON to stdout:
|
|
573
|
+
{"fixtures":{"test_suite":{"total":N,"passed":N,"failed":N,"duration_ms":N}}}
|
|
574
|
+
- Redirect all non-JSON output to stderr
|
|
575
|
+
- Strategy per framework:
|
|
576
|
+
- jest/vitest: --json flag \u2192 parse JSON
|
|
577
|
+
- pytest: --tb=no -q \u2192 parse summary line
|
|
578
|
+
- go test: -json \u2192 aggregate
|
|
579
|
+
- cargo test: parse "test result:" line
|
|
580
|
+
- no tests: stub with {"fixtures":{"project":{"has_tests":0}}}
|
|
581
|
+
|
|
582
|
+
Phase 3: Output Config (turns 26-30)
|
|
583
|
+
- Output structured JSON with verified commands and config
|
|
584
|
+
|
|
585
|
+
## Edge Cases
|
|
586
|
+
- Build fails \u2192 set build_command: null, note issue, metrics wrapper still works
|
|
587
|
+
- Tests fail \u2192 wrapper still outputs valid JSON with the fail counts
|
|
588
|
+
- No tests \u2192 stub wrapper
|
|
589
|
+
- Huge monorepo \u2192 focus on primary workspace
|
|
590
|
+
|
|
591
|
+
You may ONLY write to .majlis/scripts/. Output your structured JSON when done.
|
|
592
|
+
|
|
593
|
+
## Structured Output Format
|
|
594
|
+
<!-- majlis-json
|
|
595
|
+
{
|
|
596
|
+
"toolsmith": {
|
|
597
|
+
"metrics_command": ".majlis/scripts/metrics.sh",
|
|
598
|
+
"build_command": "npm run build",
|
|
599
|
+
"test_command": "npm test",
|
|
600
|
+
"test_framework": "jest",
|
|
601
|
+
"pre_measure": null,
|
|
602
|
+
"post_measure": null,
|
|
603
|
+
"fixtures": {},
|
|
604
|
+
"tracked": {},
|
|
605
|
+
"verification_output": "brief summary of what worked",
|
|
606
|
+
"issues": ["list of issues encountered"]
|
|
607
|
+
}
|
|
608
|
+
}
|
|
508
609
|
-->`,
|
|
509
610
|
diagnostician: `---
|
|
510
611
|
name: diagnostician
|
|
@@ -640,6 +741,23 @@ If the CLI is not installed, perform a deep diagnostic analysis.
|
|
|
640
741
|
Read docs/synthesis/current.md, fragility.md, dead-ends.md, and all experiments.
|
|
641
742
|
Identify root causes, recurring patterns, evidence gaps, and investigation directions.
|
|
642
743
|
Do NOT modify project code \u2014 analysis only.`
|
|
744
|
+
},
|
|
745
|
+
scan: {
|
|
746
|
+
description: "Scan existing project to auto-detect config and write synthesis",
|
|
747
|
+
body: `Run \`majlis scan\` to analyze the existing codebase.
|
|
748
|
+
This spawns two agents in parallel:
|
|
749
|
+
- Cartographer: maps architecture \u2192 docs/synthesis/current.md + fragility.md
|
|
750
|
+
- Toolsmith: verifies toolchain \u2192 .majlis/scripts/metrics.sh + config.json
|
|
751
|
+
Use --force to overwrite existing synthesis files.`
|
|
752
|
+
},
|
|
753
|
+
resync: {
|
|
754
|
+
description: "Update stale synthesis after project evolved without Majlis",
|
|
755
|
+
body: `Run \`majlis resync\` to bring Majlis back up to speed.
|
|
756
|
+
Unlike scan (which starts from zero), resync starts from existing knowledge.
|
|
757
|
+
It assesses staleness, then re-runs cartographer (always) and toolsmith (if needed)
|
|
758
|
+
with the old synthesis and DB history as context.
|
|
759
|
+
Use --check to see the staleness report without making changes.
|
|
760
|
+
Use --force to skip active experiment checks.`
|
|
643
761
|
}
|
|
644
762
|
};
|
|
645
763
|
var HOOKS_CONFIG = {
|
|
@@ -1034,6 +1152,7 @@ function scaffoldFresh(targetDir, answers, noHooks, minimal) {
|
|
|
1034
1152
|
\x1B[32m\x1B[1mDone!\x1B[0m Project created at ${p}`);
|
|
1035
1153
|
console.log(`
|
|
1036
1154
|
cd ${targetDir}`);
|
|
1155
|
+
console.log(" majlis scan # auto-detect project configuration");
|
|
1037
1156
|
console.log(" majlis status");
|
|
1038
1157
|
console.log(' majlis session start "First session"');
|
|
1039
1158
|
console.log(' majlis new "First hypothesis"\n');
|
|
@@ -1058,11 +1177,12 @@ function scaffoldInit(targetDir, answers, noHooks, minimal) {
|
|
|
1058
1177
|
}
|
|
1059
1178
|
console.log(`
|
|
1060
1179
|
\x1B[32m\x1B[1mDone!\x1B[0m Majlis added to ${p}`);
|
|
1061
|
-
console.log("\n majlis
|
|
1180
|
+
console.log("\n majlis scan # auto-detect project configuration");
|
|
1181
|
+
console.log(" majlis status");
|
|
1062
1182
|
console.log(' majlis session start "First session"\n');
|
|
1063
1183
|
}
|
|
1064
1184
|
function scaffoldMajlisFiles(projectRoot, answers, noHooks, minimal) {
|
|
1065
|
-
const agentNames = minimal ? ["builder", "critic", "verifier", "compressor", "gatekeeper", "diagnostician"] : ["builder", "critic", "adversary", "verifier", "reframer", "compressor", "scout", "gatekeeper", "diagnostician"];
|
|
1185
|
+
const agentNames = minimal ? ["builder", "critic", "verifier", "compressor", "gatekeeper", "diagnostician", "cartographer", "toolsmith"] : ["builder", "critic", "adversary", "verifier", "reframer", "compressor", "scout", "gatekeeper", "diagnostician", "cartographer", "toolsmith"];
|
|
1066
1186
|
const majlisDir = path.join(projectRoot, ".majlis");
|
|
1067
1187
|
mkdirSafe(majlisDir);
|
|
1068
1188
|
const configPath = path.join(majlisDir, "config.json");
|