stackmem 1.0.9 → 1.0.10
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 +32 -16
- package/package.json +1 -1
- package/src/cli.ts +32 -14
package/dist/cli.js
CHANGED
|
@@ -840,6 +840,14 @@ function writeProjectFile(project, resolvedPath) {
|
|
|
840
840
|
// non-interactive). Returns how many memories were actually saved.
|
|
841
841
|
async function seedMemories(project, resolvedPath) {
|
|
842
842
|
let seededCount = 0;
|
|
843
|
+
const { data: existingRows, error: existingError } = await supabase
|
|
844
|
+
.from("memories")
|
|
845
|
+
.select("id, content")
|
|
846
|
+
.eq("project", project)
|
|
847
|
+
.eq("resolved", false);
|
|
848
|
+
if (existingError)
|
|
849
|
+
fail(`Failed to load memories: ${existingError.message}`);
|
|
850
|
+
const existingMemories = existingRows ?? [];
|
|
843
851
|
const packageJsonPath = nodePath.join(resolvedPath, "package.json");
|
|
844
852
|
if (nodeFs.existsSync(packageJsonPath)) {
|
|
845
853
|
try {
|
|
@@ -849,14 +857,18 @@ async function seedMemories(project, resolvedPath) {
|
|
|
849
857
|
...Object.keys(pkg.devDependencies ?? {}),
|
|
850
858
|
];
|
|
851
859
|
if (depNames.length > 0) {
|
|
852
|
-
const
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
+
const content = `tech stack: ${depNames.join(", ")}`;
|
|
861
|
+
const decision = decideSaveAction(content, existingMemories);
|
|
862
|
+
if (decision.action !== "duplicate") {
|
|
863
|
+
const { error } = await supabase.from("memories").insert({
|
|
864
|
+
project,
|
|
865
|
+
type: "discovery",
|
|
866
|
+
content,
|
|
867
|
+
device_id: getDeviceId(),
|
|
868
|
+
});
|
|
869
|
+
if (!error)
|
|
870
|
+
seededCount++;
|
|
871
|
+
}
|
|
860
872
|
}
|
|
861
873
|
}
|
|
862
874
|
catch {
|
|
@@ -871,14 +883,18 @@ async function seedMemories(project, resolvedPath) {
|
|
|
871
883
|
.filter((line) => /^[A-Z_]+=/.test(line))
|
|
872
884
|
.map((line) => line.split("=")[0]);
|
|
873
885
|
if (varNames.length > 0) {
|
|
874
|
-
const
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
886
|
+
const content = `required env vars: ${varNames.join(", ")}`;
|
|
887
|
+
const decision = decideSaveAction(content, existingMemories);
|
|
888
|
+
if (decision.action !== "duplicate") {
|
|
889
|
+
const { error } = await supabase.from("memories").insert({
|
|
890
|
+
project,
|
|
891
|
+
type: "constraint",
|
|
892
|
+
content,
|
|
893
|
+
device_id: getDeviceId(),
|
|
894
|
+
});
|
|
895
|
+
if (!error)
|
|
896
|
+
seededCount++;
|
|
897
|
+
}
|
|
882
898
|
}
|
|
883
899
|
}
|
|
884
900
|
analyzeCodebase(resolvedPath);
|
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -957,6 +957,16 @@ function writeProjectFile(project: string, resolvedPath: string): void {
|
|
|
957
957
|
async function seedMemories(project: string, resolvedPath: string): Promise<number> {
|
|
958
958
|
let seededCount = 0;
|
|
959
959
|
|
|
960
|
+
const { data: existingRows, error: existingError } = await supabase
|
|
961
|
+
.from("memories")
|
|
962
|
+
.select("id, content")
|
|
963
|
+
.eq("project", project)
|
|
964
|
+
.eq("resolved", false);
|
|
965
|
+
|
|
966
|
+
if (existingError) fail(`Failed to load memories: ${existingError.message}`);
|
|
967
|
+
|
|
968
|
+
const existingMemories = existingRows ?? [];
|
|
969
|
+
|
|
960
970
|
const packageJsonPath = nodePath.join(resolvedPath, "package.json");
|
|
961
971
|
if (nodeFs.existsSync(packageJsonPath)) {
|
|
962
972
|
try {
|
|
@@ -966,13 +976,17 @@ async function seedMemories(project: string, resolvedPath: string): Promise<numb
|
|
|
966
976
|
...Object.keys(pkg.devDependencies ?? {}),
|
|
967
977
|
];
|
|
968
978
|
if (depNames.length > 0) {
|
|
969
|
-
const
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
979
|
+
const content = `tech stack: ${depNames.join(", ")}`;
|
|
980
|
+
const decision = decideSaveAction(content, existingMemories);
|
|
981
|
+
if (decision.action !== "duplicate") {
|
|
982
|
+
const { error } = await supabase.from("memories").insert({
|
|
983
|
+
project,
|
|
984
|
+
type: "discovery",
|
|
985
|
+
content,
|
|
986
|
+
device_id: getDeviceId(),
|
|
987
|
+
});
|
|
988
|
+
if (!error) seededCount++;
|
|
989
|
+
}
|
|
976
990
|
}
|
|
977
991
|
} catch {
|
|
978
992
|
// Malformed package.json — skip the tech-stack memory.
|
|
@@ -988,13 +1002,17 @@ async function seedMemories(project: string, resolvedPath: string): Promise<numb
|
|
|
988
1002
|
.map((line) => line.split("=")[0]);
|
|
989
1003
|
|
|
990
1004
|
if (varNames.length > 0) {
|
|
991
|
-
const
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
1005
|
+
const content = `required env vars: ${varNames.join(", ")}`;
|
|
1006
|
+
const decision = decideSaveAction(content, existingMemories);
|
|
1007
|
+
if (decision.action !== "duplicate") {
|
|
1008
|
+
const { error } = await supabase.from("memories").insert({
|
|
1009
|
+
project,
|
|
1010
|
+
type: "constraint",
|
|
1011
|
+
content,
|
|
1012
|
+
device_id: getDeviceId(),
|
|
1013
|
+
});
|
|
1014
|
+
if (!error) seededCount++;
|
|
1015
|
+
}
|
|
998
1016
|
}
|
|
999
1017
|
}
|
|
1000
1018
|
|