@openspecui/core 3.1.1 → 3.1.2
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.mjs +43 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3873,6 +3873,17 @@ async function readEntriesUnderRoot(root) {
|
|
|
3873
3873
|
};
|
|
3874
3874
|
return collectEntries(root);
|
|
3875
3875
|
}
|
|
3876
|
+
function splitRelativePathSegments(path) {
|
|
3877
|
+
return path.replace(/\\/g, "/").split("/").filter(Boolean);
|
|
3878
|
+
}
|
|
3879
|
+
function getGlobStaticPrefix(outputPath) {
|
|
3880
|
+
const normalizedPath = outputPath.replace(/\\/g, "/");
|
|
3881
|
+
const firstGlobIndex = normalizedPath.search(/[*?[]/);
|
|
3882
|
+
if (firstGlobIndex === -1) return normalizedPath;
|
|
3883
|
+
const staticPrefix = normalizedPath.slice(0, firstGlobIndex);
|
|
3884
|
+
const lastSlashIndex = staticPrefix.lastIndexOf("/");
|
|
3885
|
+
return lastSlashIndex === -1 ? "" : staticPrefix.slice(0, lastSlashIndex);
|
|
3886
|
+
}
|
|
3876
3887
|
async function readGlobArtifactFiles(projectDir, changeId, outputPath) {
|
|
3877
3888
|
return (await readEntriesUnderRoot(join$1(projectDir, "openspec", "changes", changeId))).filter((entry) => entry.type === "file" && matchesGlob(entry.path, outputPath)).map((entry) => ({
|
|
3878
3889
|
path: entry.path,
|
|
@@ -3900,6 +3911,34 @@ async function touchOpsxChangeDeps(projectDir, changeId) {
|
|
|
3900
3911
|
await reactiveReadDir(changeDir, { includeHidden: true });
|
|
3901
3912
|
await reactiveReadFile(join$1(changeDir, ".openspec.yaml"));
|
|
3902
3913
|
}
|
|
3914
|
+
async function touchDirectoryPathDeps(rootDir, relativePath) {
|
|
3915
|
+
let currentPath = rootDir;
|
|
3916
|
+
for (const segment of splitRelativePathSegments(relativePath)) {
|
|
3917
|
+
currentPath = join$1(currentPath, segment);
|
|
3918
|
+
await reactiveExists(currentPath);
|
|
3919
|
+
}
|
|
3920
|
+
}
|
|
3921
|
+
async function touchDirectoryTree(rootDir) {
|
|
3922
|
+
if (!(await reactiveStat(rootDir))?.isDirectory) return;
|
|
3923
|
+
const entries = await reactiveReadDir(rootDir, { includeHidden: true });
|
|
3924
|
+
await Promise.all(entries.map(async (entryName) => {
|
|
3925
|
+
const entryPath = join$1(rootDir, entryName);
|
|
3926
|
+
if ((await reactiveStat(entryPath))?.isDirectory) await touchDirectoryTree(entryPath);
|
|
3927
|
+
}));
|
|
3928
|
+
}
|
|
3929
|
+
async function touchArtifactOutputDeps(projectDir, changeId, outputPath) {
|
|
3930
|
+
const changeDir = join$1(projectDir, "openspec", "changes", changeId);
|
|
3931
|
+
const normalizedOutputPath = outputPath.replace(/\\/g, "/");
|
|
3932
|
+
if (isGlobPattern(normalizedOutputPath)) {
|
|
3933
|
+
const staticPrefix = getGlobStaticPrefix(normalizedOutputPath);
|
|
3934
|
+
if (staticPrefix) await touchDirectoryPathDeps(changeDir, staticPrefix);
|
|
3935
|
+
await touchDirectoryTree(staticPrefix ? join$1(changeDir, staticPrefix) : changeDir);
|
|
3936
|
+
return;
|
|
3937
|
+
}
|
|
3938
|
+
const parentPath = splitRelativePathSegments(normalizedOutputPath).slice(0, -1).join("/");
|
|
3939
|
+
if (parentPath) await touchDirectoryPathDeps(changeDir, parentPath);
|
|
3940
|
+
await reactiveExists(join$1(changeDir, normalizedOutputPath));
|
|
3941
|
+
}
|
|
3903
3942
|
var OpsxKernel = class {
|
|
3904
3943
|
projectDir;
|
|
3905
3944
|
cliExecutor;
|
|
@@ -4237,7 +4276,10 @@ var OpsxKernel = class {
|
|
|
4237
4276
|
if (!result.success) throw new Error(result.stderr || `openspec status failed (exit ${result.exitCode ?? "null"})`);
|
|
4238
4277
|
const status = parseCliJson(result.stdout, ChangeStatusSchema, "openspec status");
|
|
4239
4278
|
const changeRelDir = `openspec/changes/${changeId}`;
|
|
4240
|
-
for (const artifact of status.artifacts)
|
|
4279
|
+
for (const artifact of status.artifacts) {
|
|
4280
|
+
artifact.relativePath = `${changeRelDir}/${artifact.outputPath}`;
|
|
4281
|
+
await touchArtifactOutputDeps(this.projectDir, changeId, artifact.outputPath);
|
|
4282
|
+
}
|
|
4241
4283
|
return status;
|
|
4242
4284
|
}
|
|
4243
4285
|
async fetchStatusList() {
|