codebyplan 1.1.0 → 1.2.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/dist/cli.js +85 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -14,7 +14,7 @@ var VERSION, PACKAGE_NAME;
|
|
|
14
14
|
var init_version = __esm({
|
|
15
15
|
"src/lib/version.ts"() {
|
|
16
16
|
"use strict";
|
|
17
|
-
VERSION = "1.
|
|
17
|
+
VERSION = "1.2.0";
|
|
18
18
|
PACKAGE_NAME = "codebyplan";
|
|
19
19
|
}
|
|
20
20
|
});
|
|
@@ -1038,6 +1038,13 @@ async function scanLocalFiles(claudeDir, projectPath) {
|
|
|
1038
1038
|
await scanFlatType(join5(claudeDir, "rules"), "rule", ".md", result);
|
|
1039
1039
|
await scanFlatType(join5(claudeDir, "hooks"), "hook", ".sh", result);
|
|
1040
1040
|
await scanTemplates(join5(claudeDir, "templates"), result);
|
|
1041
|
+
await scanCategorizedType(
|
|
1042
|
+
join5(claudeDir, "context"),
|
|
1043
|
+
"context",
|
|
1044
|
+
".md",
|
|
1045
|
+
result
|
|
1046
|
+
);
|
|
1047
|
+
await scanDocsRecursive(join5(claudeDir, "docs"), result);
|
|
1041
1048
|
await scanSettings(claudeDir, projectPath, result);
|
|
1042
1049
|
return result;
|
|
1043
1050
|
}
|
|
@@ -1112,6 +1119,69 @@ async function scanFlatType(dir, type, ext, result) {
|
|
|
1112
1119
|
}
|
|
1113
1120
|
}
|
|
1114
1121
|
}
|
|
1122
|
+
async function scanCategorizedType(dir, type, ext, result) {
|
|
1123
|
+
let entries;
|
|
1124
|
+
try {
|
|
1125
|
+
entries = await readdir3(dir, { withFileTypes: true });
|
|
1126
|
+
} catch {
|
|
1127
|
+
return;
|
|
1128
|
+
}
|
|
1129
|
+
for (const entry of entries) {
|
|
1130
|
+
if (entry.isDirectory()) {
|
|
1131
|
+
const category = entry.name;
|
|
1132
|
+
let subEntries;
|
|
1133
|
+
try {
|
|
1134
|
+
subEntries = await readdir3(join5(dir, category), {
|
|
1135
|
+
withFileTypes: true
|
|
1136
|
+
});
|
|
1137
|
+
} catch {
|
|
1138
|
+
continue;
|
|
1139
|
+
}
|
|
1140
|
+
for (const sub of subEntries) {
|
|
1141
|
+
if (sub.isFile() && sub.name.endsWith(ext)) {
|
|
1142
|
+
const name = sub.name.slice(0, -ext.length);
|
|
1143
|
+
const content = await readFile5(
|
|
1144
|
+
join5(dir, category, sub.name),
|
|
1145
|
+
"utf-8"
|
|
1146
|
+
);
|
|
1147
|
+
const scope = extractScope(content, type);
|
|
1148
|
+
const key = compositeKey(type, name, category);
|
|
1149
|
+
result.set(key, { type, name, category, content, scope });
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
} else if (entry.isFile() && entry.name.endsWith(ext)) {
|
|
1153
|
+
const name = entry.name.slice(0, -ext.length);
|
|
1154
|
+
const content = await readFile5(join5(dir, entry.name), "utf-8");
|
|
1155
|
+
const scope = extractScope(content, type);
|
|
1156
|
+
const key = compositeKey(type, name, null);
|
|
1157
|
+
result.set(key, { type, name, category: null, content, scope });
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
async function scanDocsRecursive(docsDir, result) {
|
|
1162
|
+
await scanDocsDir(docsDir, docsDir, result);
|
|
1163
|
+
}
|
|
1164
|
+
async function scanDocsDir(baseDir, currentDir, result) {
|
|
1165
|
+
let entries;
|
|
1166
|
+
try {
|
|
1167
|
+
entries = await readdir3(currentDir, { withFileTypes: true });
|
|
1168
|
+
} catch {
|
|
1169
|
+
return;
|
|
1170
|
+
}
|
|
1171
|
+
for (const entry of entries) {
|
|
1172
|
+
if (entry.isDirectory()) {
|
|
1173
|
+
await scanDocsDir(baseDir, join5(currentDir, entry.name), result);
|
|
1174
|
+
} else if (entry.isFile() && entry.name.endsWith(".md")) {
|
|
1175
|
+
const name = entry.name.slice(0, -3);
|
|
1176
|
+
const content = await readFile5(join5(currentDir, entry.name), "utf-8");
|
|
1177
|
+
const scope = extractScope(content, "docs");
|
|
1178
|
+
const relDir = currentDir.slice(baseDir.length + 1);
|
|
1179
|
+
const category = relDir || null;
|
|
1180
|
+
const key = compositeKey("docs", name, category);
|
|
1181
|
+
result.set(key, { type: "docs", name, category, content, scope });
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1115
1185
|
async function scanTemplates(dir, result) {
|
|
1116
1186
|
let entries;
|
|
1117
1187
|
try {
|
|
@@ -2667,7 +2737,10 @@ function groupByType(items) {
|
|
|
2667
2737
|
rule: "Rules",
|
|
2668
2738
|
hook: "Hooks",
|
|
2669
2739
|
template: "Templates",
|
|
2670
|
-
settings: "Settings"
|
|
2740
|
+
settings: "Settings",
|
|
2741
|
+
context: "Context",
|
|
2742
|
+
docs_stack: "Stack Docs",
|
|
2743
|
+
docs: "Docs"
|
|
2671
2744
|
};
|
|
2672
2745
|
for (const item of items) {
|
|
2673
2746
|
const label = typeLabels[item.type] ?? item.type;
|
|
@@ -2685,6 +2758,9 @@ function getLocalFilePath(claudeDir, projectPath, remote) {
|
|
|
2685
2758
|
rule: { dir: "rules", ext: ".md" },
|
|
2686
2759
|
hook: { dir: "hooks", ext: ".sh" },
|
|
2687
2760
|
template: { dir: "templates", ext: "" },
|
|
2761
|
+
context: { dir: "context", ext: ".md" },
|
|
2762
|
+
docs_stack: { dir: join7("docs", "stack"), ext: ".md" },
|
|
2763
|
+
docs: { dir: "docs", ext: ".md" },
|
|
2688
2764
|
claude_md: { dir: "", ext: "" },
|
|
2689
2765
|
settings: { dir: "", ext: "" }
|
|
2690
2766
|
};
|
|
@@ -2698,11 +2774,13 @@ function getLocalFilePath(claudeDir, projectPath, remote) {
|
|
|
2698
2774
|
if (remote.type === "command" && remote.category)
|
|
2699
2775
|
return join7(typeDir, remote.category, `${remote.name}${cfg.ext}`);
|
|
2700
2776
|
if (remote.type === "template") return join7(typeDir, remote.name);
|
|
2777
|
+
if (remote.category && (remote.type === "context" || remote.type === "docs_stack" || remote.type === "docs"))
|
|
2778
|
+
return join7(typeDir, remote.category, `${remote.name}${cfg.ext}`);
|
|
2701
2779
|
return join7(typeDir, `${remote.name}${cfg.ext}`);
|
|
2702
2780
|
}
|
|
2703
2781
|
function getSyncVersion() {
|
|
2704
2782
|
try {
|
|
2705
|
-
return "1.
|
|
2783
|
+
return "1.2.0";
|
|
2706
2784
|
} catch {
|
|
2707
2785
|
return "unknown";
|
|
2708
2786
|
}
|
|
@@ -2716,7 +2794,10 @@ function flattenSyncData(data) {
|
|
|
2716
2794
|
rules: "rule",
|
|
2717
2795
|
hooks: "hook",
|
|
2718
2796
|
templates: "template",
|
|
2719
|
-
settings: "settings"
|
|
2797
|
+
settings: "settings",
|
|
2798
|
+
contexts: "context",
|
|
2799
|
+
docs_stack: "docs_stack",
|
|
2800
|
+
docs: "docs"
|
|
2720
2801
|
};
|
|
2721
2802
|
for (const [syncKey, typeName] of Object.entries(typeMap)) {
|
|
2722
2803
|
const files = data[syncKey] ?? [];
|