@benzotti/jedi 0.1.11 → 0.1.12
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 +51 -31
- package/framework/commands/init.md +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9218,6 +9218,7 @@ async function runMain(cmd, opts = {}) {
|
|
|
9218
9218
|
|
|
9219
9219
|
// src/commands/init.ts
|
|
9220
9220
|
import { join as join3 } from "path";
|
|
9221
|
+
import { existsSync as existsSync3 } from "fs";
|
|
9221
9222
|
|
|
9222
9223
|
// src/utils/detect-project.ts
|
|
9223
9224
|
import { existsSync } from "fs";
|
|
@@ -9436,12 +9437,31 @@ var initCommand = defineCommand({
|
|
|
9436
9437
|
".jdi/codebase",
|
|
9437
9438
|
".jdi/reviews",
|
|
9438
9439
|
".jdi/config",
|
|
9439
|
-
".jdi/persistence"
|
|
9440
|
+
".jdi/persistence",
|
|
9441
|
+
".jdi/feedback"
|
|
9440
9442
|
];
|
|
9441
9443
|
for (const dir of dirs) {
|
|
9442
9444
|
await Bun.write(join3(cwd, dir, ".gitkeep"), "");
|
|
9443
9445
|
}
|
|
9444
9446
|
await copyFrameworkFiles(cwd, projectType, args.force, args.ci);
|
|
9447
|
+
const configFiles = ["state.yaml", "variables.yaml", "jdi-config.yaml"];
|
|
9448
|
+
for (const file of configFiles) {
|
|
9449
|
+
const src2 = join3(cwd, ".jdi", "framework", "config", file);
|
|
9450
|
+
const dest = join3(cwd, ".jdi", "config", file);
|
|
9451
|
+
if (existsSync3(src2) && (args.force || !existsSync3(dest))) {
|
|
9452
|
+
const content = await Bun.file(src2).text();
|
|
9453
|
+
await Bun.write(dest, content);
|
|
9454
|
+
}
|
|
9455
|
+
}
|
|
9456
|
+
const scaffoldFiles = ["PROJECT.yaml", "REQUIREMENTS.yaml", "ROADMAP.yaml"];
|
|
9457
|
+
for (const file of scaffoldFiles) {
|
|
9458
|
+
const src2 = join3(cwd, ".jdi", "framework", "templates", file);
|
|
9459
|
+
const dest = join3(cwd, ".jdi", file);
|
|
9460
|
+
if (existsSync3(src2) && !existsSync3(dest)) {
|
|
9461
|
+
const content = await Bun.file(src2).text();
|
|
9462
|
+
await Bun.write(dest, content);
|
|
9463
|
+
}
|
|
9464
|
+
}
|
|
9445
9465
|
if (args.storage || args["storage-path"]) {
|
|
9446
9466
|
const { parse, stringify } = await Promise.resolve().then(() => __toESM(require_dist(), 1));
|
|
9447
9467
|
const configPath = join3(cwd, ".jdi", "config", "jdi-config.yaml");
|
|
@@ -9483,10 +9503,10 @@ import { resolve as resolve2 } from "path";
|
|
|
9483
9503
|
// src/utils/adapter.ts
|
|
9484
9504
|
var import_yaml = __toESM(require_dist(), 1);
|
|
9485
9505
|
import { join as join4 } from "path";
|
|
9486
|
-
import { existsSync as
|
|
9506
|
+
import { existsSync as existsSync4 } from "fs";
|
|
9487
9507
|
async function readAdapter(cwd) {
|
|
9488
9508
|
const adapterPath = join4(cwd, ".jdi", "config", "adapter.yaml");
|
|
9489
|
-
if (!
|
|
9509
|
+
if (!existsSync4(adapterPath))
|
|
9490
9510
|
return null;
|
|
9491
9511
|
const content = await Bun.file(adapterPath).text();
|
|
9492
9512
|
return import_yaml.parse(content);
|
|
@@ -9619,11 +9639,11 @@ async function spawnClaude(prompt2, opts) {
|
|
|
9619
9639
|
// src/storage/index.ts
|
|
9620
9640
|
var import_yaml2 = __toESM(require_dist(), 1);
|
|
9621
9641
|
import { join as join6 } from "path";
|
|
9622
|
-
import { existsSync as
|
|
9642
|
+
import { existsSync as existsSync6 } from "fs";
|
|
9623
9643
|
|
|
9624
9644
|
// src/storage/fs-storage.ts
|
|
9625
9645
|
import { join as join5 } from "path";
|
|
9626
|
-
import { existsSync as
|
|
9646
|
+
import { existsSync as existsSync5, mkdirSync as mkdirSync2 } from "fs";
|
|
9627
9647
|
|
|
9628
9648
|
class FsStorage {
|
|
9629
9649
|
basePath;
|
|
@@ -9632,12 +9652,12 @@ class FsStorage {
|
|
|
9632
9652
|
}
|
|
9633
9653
|
async load(key) {
|
|
9634
9654
|
const filePath = join5(this.basePath, `${key}.md`);
|
|
9635
|
-
if (!
|
|
9655
|
+
if (!existsSync5(filePath))
|
|
9636
9656
|
return null;
|
|
9637
9657
|
return Bun.file(filePath).text();
|
|
9638
9658
|
}
|
|
9639
9659
|
async save(key, content) {
|
|
9640
|
-
if (!
|
|
9660
|
+
if (!existsSync5(this.basePath)) {
|
|
9641
9661
|
mkdirSync2(this.basePath, { recursive: true });
|
|
9642
9662
|
}
|
|
9643
9663
|
const filePath = join5(this.basePath, `${key}.md`);
|
|
@@ -9651,7 +9671,7 @@ async function createStorage(cwd, config) {
|
|
|
9651
9671
|
let basePath = config?.basePath;
|
|
9652
9672
|
if (!config?.adapter && !config?.basePath) {
|
|
9653
9673
|
const configPath = join6(cwd, ".jdi", "config", "jdi-config.yaml");
|
|
9654
|
-
if (
|
|
9674
|
+
if (existsSync6(configPath)) {
|
|
9655
9675
|
const content = await Bun.file(configPath).text();
|
|
9656
9676
|
const parsed = import_yaml2.parse(content);
|
|
9657
9677
|
if (parsed?.storage?.adapter)
|
|
@@ -9665,7 +9685,7 @@ async function createStorage(cwd, config) {
|
|
|
9665
9685
|
return new FsStorage(resolvedPath);
|
|
9666
9686
|
}
|
|
9667
9687
|
const adapterPath = join6(cwd, adapter);
|
|
9668
|
-
if (!
|
|
9688
|
+
if (!existsSync6(adapterPath)) {
|
|
9669
9689
|
throw new Error(`Storage adapter not found: ${adapterPath}
|
|
9670
9690
|
` + `Set storage.adapter in .jdi/config/jdi-config.yaml to "fs" or a path to a custom adapter module.`);
|
|
9671
9691
|
}
|
|
@@ -9689,14 +9709,14 @@ async function createStorage(cwd, config) {
|
|
|
9689
9709
|
|
|
9690
9710
|
// src/utils/storage-lifecycle.ts
|
|
9691
9711
|
import { join as join7 } from "path";
|
|
9692
|
-
import { existsSync as
|
|
9712
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync3 } from "fs";
|
|
9693
9713
|
async function loadPersistedState(cwd, storage) {
|
|
9694
9714
|
let learningsPath = null;
|
|
9695
9715
|
let codebaseIndexPath = null;
|
|
9696
9716
|
const learnings = await storage.load("learnings");
|
|
9697
9717
|
if (learnings) {
|
|
9698
9718
|
const dir = join7(cwd, ".jdi", "framework", "learnings");
|
|
9699
|
-
if (!
|
|
9719
|
+
if (!existsSync7(dir))
|
|
9700
9720
|
mkdirSync3(dir, { recursive: true });
|
|
9701
9721
|
learningsPath = join7(dir, "_consolidated.md");
|
|
9702
9722
|
await Bun.write(learningsPath, learnings);
|
|
@@ -9704,7 +9724,7 @@ async function loadPersistedState(cwd, storage) {
|
|
|
9704
9724
|
const codebaseIndex = await storage.load("codebase-index");
|
|
9705
9725
|
if (codebaseIndex) {
|
|
9706
9726
|
const dir = join7(cwd, ".jdi", "codebase");
|
|
9707
|
-
if (!
|
|
9727
|
+
if (!existsSync7(dir))
|
|
9708
9728
|
mkdirSync3(dir, { recursive: true });
|
|
9709
9729
|
codebaseIndexPath = join7(dir, "INDEX.md");
|
|
9710
9730
|
await Bun.write(codebaseIndexPath, codebaseIndex);
|
|
@@ -9715,7 +9735,7 @@ async function savePersistedState(cwd, storage) {
|
|
|
9715
9735
|
let learningsSaved = false;
|
|
9716
9736
|
let codebaseIndexSaved = false;
|
|
9717
9737
|
const learningsDir = join7(cwd, ".jdi", "framework", "learnings");
|
|
9718
|
-
if (
|
|
9738
|
+
if (existsSync7(learningsDir)) {
|
|
9719
9739
|
const merged = await mergeLearningFiles(learningsDir);
|
|
9720
9740
|
if (merged) {
|
|
9721
9741
|
await storage.save("learnings", merged);
|
|
@@ -9723,7 +9743,7 @@ async function savePersistedState(cwd, storage) {
|
|
|
9723
9743
|
}
|
|
9724
9744
|
}
|
|
9725
9745
|
const indexPath = join7(cwd, ".jdi", "codebase", "INDEX.md");
|
|
9726
|
-
if (
|
|
9746
|
+
if (existsSync7(indexPath)) {
|
|
9727
9747
|
const content = await Bun.file(indexPath).text();
|
|
9728
9748
|
if (content.trim()) {
|
|
9729
9749
|
await storage.save("codebase-index", content);
|
|
@@ -9737,7 +9757,7 @@ async function mergeLearningFiles(dir) {
|
|
|
9737
9757
|
const sections = [];
|
|
9738
9758
|
for (const category of categories) {
|
|
9739
9759
|
const filePath = join7(dir, `${category}.md`);
|
|
9740
|
-
if (!
|
|
9760
|
+
if (!existsSync7(filePath))
|
|
9741
9761
|
continue;
|
|
9742
9762
|
const content = await Bun.file(filePath).text();
|
|
9743
9763
|
const trimmed = content.trim();
|
|
@@ -9748,7 +9768,7 @@ async function mergeLearningFiles(dir) {
|
|
|
9748
9768
|
sections.push(trimmed);
|
|
9749
9769
|
}
|
|
9750
9770
|
const consolidatedPath = join7(dir, "_consolidated.md");
|
|
9751
|
-
if (
|
|
9771
|
+
if (existsSync7(consolidatedPath)) {
|
|
9752
9772
|
const content = await Bun.file(consolidatedPath).text();
|
|
9753
9773
|
const trimmed = content.trim();
|
|
9754
9774
|
if (trimmed && !sections.some((s2) => s2.includes(trimmed))) {
|
|
@@ -9832,10 +9852,10 @@ import { resolve as resolve3 } from "path";
|
|
|
9832
9852
|
// src/utils/state.ts
|
|
9833
9853
|
var import_yaml3 = __toESM(require_dist(), 1);
|
|
9834
9854
|
import { join as join8 } from "path";
|
|
9835
|
-
import { existsSync as
|
|
9855
|
+
import { existsSync as existsSync8 } from "fs";
|
|
9836
9856
|
async function readState(cwd) {
|
|
9837
9857
|
const statePath = join8(cwd, ".jdi", "config", "state.yaml");
|
|
9838
|
-
if (!
|
|
9858
|
+
if (!existsSync8(statePath))
|
|
9839
9859
|
return null;
|
|
9840
9860
|
const content = await Bun.file(statePath).text();
|
|
9841
9861
|
return import_yaml3.parse(content);
|
|
@@ -10152,7 +10172,7 @@ Use --all to stage and commit all, or stage files manually.`);
|
|
|
10152
10172
|
});
|
|
10153
10173
|
|
|
10154
10174
|
// src/commands/pr.ts
|
|
10155
|
-
import { existsSync as
|
|
10175
|
+
import { existsSync as existsSync9 } from "fs";
|
|
10156
10176
|
import { join as join10 } from "path";
|
|
10157
10177
|
async function hasGhCli() {
|
|
10158
10178
|
const { exitCode } = await exec(["which", "gh"]);
|
|
@@ -10204,7 +10224,7 @@ var prCommand = defineCommand({
|
|
|
10204
10224
|
**Plan:** ${state.position.plan_name}` : "";
|
|
10205
10225
|
let template = "";
|
|
10206
10226
|
const templatePath = join10(cwd, ".github", "pull_request_template.md");
|
|
10207
|
-
if (
|
|
10227
|
+
if (existsSync9(templatePath)) {
|
|
10208
10228
|
template = await Bun.file(templatePath).text();
|
|
10209
10229
|
}
|
|
10210
10230
|
const title = branch.replace(/^(feat|fix|chore|docs|refactor|test|ci)\//, "").replace(/[-_]/g, " ").replace(/^\w/, (c3) => c3.toUpperCase());
|
|
@@ -10552,7 +10572,7 @@ var quickCommand = defineCommand({
|
|
|
10552
10572
|
});
|
|
10553
10573
|
|
|
10554
10574
|
// src/commands/worktree.ts
|
|
10555
|
-
import { existsSync as
|
|
10575
|
+
import { existsSync as existsSync10 } from "fs";
|
|
10556
10576
|
function slugify(name) {
|
|
10557
10577
|
return name.toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "").slice(0, 40);
|
|
10558
10578
|
}
|
|
@@ -10586,7 +10606,7 @@ var worktreeCommand = defineCommand({
|
|
|
10586
10606
|
}
|
|
10587
10607
|
const slug = slugify(args.name);
|
|
10588
10608
|
const worktreePath = `${root}/.worktrees/${slug}`;
|
|
10589
|
-
if (
|
|
10609
|
+
if (existsSync10(worktreePath)) {
|
|
10590
10610
|
consola.error(`Worktree already exists at ${worktreePath}`);
|
|
10591
10611
|
return;
|
|
10592
10612
|
}
|
|
@@ -10752,7 +10772,7 @@ Specify a worktree name: jdi worktree-remove <name>`);
|
|
|
10752
10772
|
|
|
10753
10773
|
// src/commands/plan-review.ts
|
|
10754
10774
|
import { resolve as resolve7 } from "path";
|
|
10755
|
-
import { existsSync as
|
|
10775
|
+
import { existsSync as existsSync11 } from "fs";
|
|
10756
10776
|
function parsePlanSummary(content) {
|
|
10757
10777
|
const nameMatch = content.match(/^# .+?: (.+)$/m);
|
|
10758
10778
|
const name = nameMatch?.[1] ?? "Unknown";
|
|
@@ -10791,7 +10811,7 @@ var planReviewCommand = defineCommand({
|
|
|
10791
10811
|
consola.error("No plan found. Run `jdi plan` first.");
|
|
10792
10812
|
return;
|
|
10793
10813
|
}
|
|
10794
|
-
if (!
|
|
10814
|
+
if (!existsSync11(planPath)) {
|
|
10795
10815
|
consola.error(`Plan not found: ${planPath}`);
|
|
10796
10816
|
return;
|
|
10797
10817
|
}
|
|
@@ -10881,7 +10901,7 @@ Tasks (${tasks.length}):`);
|
|
|
10881
10901
|
|
|
10882
10902
|
// src/commands/plan-approve.ts
|
|
10883
10903
|
import { resolve as resolve8 } from "path";
|
|
10884
|
-
import { existsSync as
|
|
10904
|
+
import { existsSync as existsSync12 } from "fs";
|
|
10885
10905
|
var planApproveCommand = defineCommand({
|
|
10886
10906
|
meta: {
|
|
10887
10907
|
name: "plan-approve",
|
|
@@ -10910,7 +10930,7 @@ var planApproveCommand = defineCommand({
|
|
|
10910
10930
|
consola.error("No plan to approve. Run `jdi plan` first.");
|
|
10911
10931
|
return;
|
|
10912
10932
|
}
|
|
10913
|
-
if (!
|
|
10933
|
+
if (!existsSync12(planPath)) {
|
|
10914
10934
|
consola.error(`Plan not found: ${planPath}`);
|
|
10915
10935
|
return;
|
|
10916
10936
|
}
|
|
@@ -11436,7 +11456,7 @@ Use the ClickUp ticket above as the primary requirements source.` : ``,
|
|
|
11436
11456
|
|
|
11437
11457
|
// src/commands/setup-action.ts
|
|
11438
11458
|
import { join as join12, dirname as dirname3 } from "path";
|
|
11439
|
-
import { existsSync as
|
|
11459
|
+
import { existsSync as existsSync13, mkdirSync as mkdirSync4 } from "fs";
|
|
11440
11460
|
var setupActionCommand = defineCommand({
|
|
11441
11461
|
meta: {
|
|
11442
11462
|
name: "setup-action",
|
|
@@ -11446,17 +11466,17 @@ var setupActionCommand = defineCommand({
|
|
|
11446
11466
|
async run() {
|
|
11447
11467
|
const cwd = process.cwd();
|
|
11448
11468
|
const workflowDest = join12(cwd, ".github", "workflows", "jedi.yml");
|
|
11449
|
-
if (
|
|
11469
|
+
if (existsSync13(workflowDest)) {
|
|
11450
11470
|
consola.warn(`Workflow already exists at ${workflowDest}`);
|
|
11451
11471
|
consola.info("Skipping workflow copy. Delete it manually to regenerate.");
|
|
11452
11472
|
} else {
|
|
11453
11473
|
const templatePath = join12(import.meta.dir, "../action/workflow-template.yml");
|
|
11454
|
-
if (!
|
|
11474
|
+
if (!existsSync13(templatePath)) {
|
|
11455
11475
|
consola.error("Workflow template not found. Ensure @benzotti/jedi is properly installed.");
|
|
11456
11476
|
process.exit(1);
|
|
11457
11477
|
}
|
|
11458
11478
|
const dir = dirname3(workflowDest);
|
|
11459
|
-
if (!
|
|
11479
|
+
if (!existsSync13(dir))
|
|
11460
11480
|
mkdirSync4(dir, { recursive: true });
|
|
11461
11481
|
const template = await Bun.file(templatePath).text();
|
|
11462
11482
|
await Bun.write(workflowDest, template);
|
|
@@ -11494,7 +11514,7 @@ var setupActionCommand = defineCommand({
|
|
|
11494
11514
|
// package.json
|
|
11495
11515
|
var package_default = {
|
|
11496
11516
|
name: "@benzotti/jedi",
|
|
11497
|
-
version: "0.1.
|
|
11517
|
+
version: "0.1.12",
|
|
11498
11518
|
description: "JDI - Context-efficient AI development framework for Claude Code",
|
|
11499
11519
|
type: "module",
|
|
11500
11520
|
bin: {
|
|
@@ -13,7 +13,7 @@ Initialise the JDI slash commands in the current project.
|
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
15
|
mkdir -p .claude/commands/jdi
|
|
16
|
-
mkdir -p .jdi/plans .jdi/research .jdi/config
|
|
16
|
+
mkdir -p .jdi/plans .jdi/research .jdi/codebase .jdi/reviews .jdi/config .jdi/persistence .jdi/feedback
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
### Step 2: Copy Command Stubs
|