@cubis/foundry 0.3.80 → 0.3.81
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/core.js +82 -11
- package/dist/cli/core.js.map +1 -1
- package/package.json +1 -1
- package/src/cli/core.ts +97 -11
- package/workflows/workflows/agent-environment-setup/platforms/antigravity/workflows/architecture.md +6 -3
- package/workflows/workflows/agent-environment-setup/platforms/claude/workflows/architecture.md +6 -3
- package/workflows/workflows/agent-environment-setup/platforms/codex/workflows/architecture.md +6 -3
- package/workflows/workflows/agent-environment-setup/platforms/copilot/workflows/architecture.md +6 -3
- package/workflows/workflows/agent-environment-setup/platforms/gemini/workflows/architecture.md +6 -3
- package/workflows/workflows/agent-environment-setup/shared/workflows/architecture.md +6 -3
package/dist/cli/core.js
CHANGED
|
@@ -10662,19 +10662,24 @@ function buildArchitecturePrompt({ platform, workspaceRoot, snapshot, specRoots,
|
|
|
10662
10662
|
`4. Then read ${productPath}, ${architecturePath}, and ${techPath} in that order when they exist so you can preserve useful manual context and update existing managed sections cleanly.`,
|
|
10663
10663
|
`5. Replace or update only the content between the existing managed markers in ${productPath}, ${architecturePath}, and ${techPath}. Do not append a second marker block.`,
|
|
10664
10664
|
`6. In ${productPath}, write a concrete product foundation: product purpose, primary users/operators, main journeys, business capabilities, operational constraints, and what future contributors must preserve.`,
|
|
10665
|
-
`7. In ${architecturePath}, write a lean but detailed architecture backbone in a pragmatic arc42/C4 style: system purpose and constraints, bounded contexts, major building blocks, dependency rules, data and integration boundaries, runtime flows, deployment/operability notes, testing/debugging strategy, and only the diagram levels that add real value.`,
|
|
10666
|
-
`8.
|
|
10667
|
-
|
|
10668
|
-
|
|
10669
|
-
|
|
10665
|
+
`7. In ${architecturePath}, write a lean but detailed architecture backbone in a pragmatic arc42/C4 style: system purpose and constraints, explicit architecture classification, bounded contexts, major building blocks, dependency rules, data and integration boundaries, runtime flows, deployment/operability notes, testing/debugging strategy, and only the diagram levels that add real value.`,
|
|
10666
|
+
`8. ${architecturePath} must include a dedicated folder-structure guide that lists the important apps/packages/directories, what each owns, and how contributors should treat those boundaries when editing code.`,
|
|
10667
|
+
`9. In ${techPath}, write the developer-facing technical map: stack, repo layout, key commands, entrypoints, data stores, external services, environment/config surfaces, MCP/tooling footprint, and change hotspots future agents should inspect before editing code.`,
|
|
10668
|
+
`10. ${techPath} should complement ${architecturePath}; do not repeat the same structure prose unless it helps a developer act faster.`,
|
|
10669
|
+
`11. Use exact required headings in ${productPath}: \`## Product Scope\`, \`## Product Purpose\`, \`## Primary Users And Operators\`, \`## Main Journeys\`, \`## Business Capabilities That Matter\`, \`## Operational Constraints\`, \`## Preservation Rules For Future Contributors\`.`,
|
|
10670
|
+
`12. Use exact required headings in ${architecturePath}: \`## Architecture Type\`, \`## System Purpose\`, \`## Constraints And Architectural Drivers\`, \`## Repository Structure Guide\`, \`## Bounded Contexts\`, \`## Major Building Blocks\`, \`## Dependency Rules\`, \`## Data Boundaries\`, \`## Integration Boundaries\`, \`## Runtime Flows\`, \`## Deployment And Operability\`, \`## Testing And Debugging Strategy\`, \`## Architectural Guidance\`.`,
|
|
10671
|
+
`13. Use exact required headings in ${techPath}: \`## Stack Snapshot\`, \`## Repository Layout\`, \`## Entrypoints\`, \`## Key Commands\`, \`## Runtime Data Stores\`, \`## External Services And Integration Surfaces\`, \`## Environment And Config Surfaces\`, \`## Generated Artifacts To Respect\`, \`## Change Hotspots\`, \`## Practical Editing Notes\`.`,
|
|
10672
|
+
"14. Every major claim should be grounded in repository evidence. Mention concrete repo paths in the docs when a structural claim would otherwise be ambiguous.",
|
|
10673
|
+
"15. Avoid placeholder filler, generic checklists, and duplicated content across files. Each doc should have a clear job.",
|
|
10674
|
+
"16. Do not create ROADMAP.md, ENGINEERING_RULES.md, or other extra docs unless the prompt explicitly asks for them.",
|
|
10670
10675
|
researchMode === "never"
|
|
10671
|
-
? "
|
|
10672
|
-
: "
|
|
10676
|
+
? "17. Stay repo-only. Do not use outside research."
|
|
10677
|
+
: "17. Use repo evidence first. Use official docs when needed. Treat Reddit or community sources only as labeled secondary evidence.",
|
|
10673
10678
|
researchMode === "always"
|
|
10674
|
-
? `
|
|
10675
|
-
: "
|
|
10676
|
-
`
|
|
10677
|
-
`
|
|
10679
|
+
? `18. Include an external research evidence subsection in ${techPath} with clearly labeled primary and secondary evidence.`
|
|
10680
|
+
: "18. Include external research notes only if they materially informed the architecture update.",
|
|
10681
|
+
`19. If the project clearly follows Clean Architecture, feature-first modules, DDD, modular monolith, or another stable structure, make that explicit in ${architecturePath} with evidence from the repo.`,
|
|
10682
|
+
`20. Ensure ${adrReadmePath} and ${adrTemplatePath} exist as ADR entrypoints, but keep them lean.`,
|
|
10678
10683
|
"",
|
|
10679
10684
|
"Return one JSON object on the last line with this shape:",
|
|
10680
10685
|
`{"files_written":["${productPath}","${architecturePath}","${techPath}","${adrReadmePath}","${adrTemplatePath}"],"research_used":false,"gaps":[],"next_actions":[]}`,
|
|
@@ -10898,6 +10903,71 @@ async function captureFileContents(filePaths) {
|
|
|
10898
10903
|
}
|
|
10899
10904
|
return snapshot;
|
|
10900
10905
|
}
|
|
10906
|
+
function collectTaggedBlocks(content, startPattern, endPattern) {
|
|
10907
|
+
const blocks = [];
|
|
10908
|
+
let cursor = 0;
|
|
10909
|
+
const startMatcher = new RegExp(startPattern.source, startPattern.flags.replace(/g/g, ""));
|
|
10910
|
+
const endMatcher = new RegExp(endPattern.source, endPattern.flags.replace(/g/g, ""));
|
|
10911
|
+
while (cursor < content.length) {
|
|
10912
|
+
const remaining = content.slice(cursor);
|
|
10913
|
+
const startMatch = remaining.match(startMatcher);
|
|
10914
|
+
if (!startMatch || startMatch.index == null)
|
|
10915
|
+
break;
|
|
10916
|
+
const startIndex = cursor + startMatch.index;
|
|
10917
|
+
const afterStart = content.slice(startIndex + startMatch[0].length);
|
|
10918
|
+
const endMatch = afterStart.match(endMatcher);
|
|
10919
|
+
if (!endMatch || endMatch.index == null)
|
|
10920
|
+
break;
|
|
10921
|
+
const endIndex = startIndex + startMatch[0].length + endMatch.index + endMatch[0].length;
|
|
10922
|
+
const block = content.slice(startIndex, endIndex);
|
|
10923
|
+
const inner = content
|
|
10924
|
+
.slice(startIndex + startMatch[0].length, endIndex - endMatch[0].length)
|
|
10925
|
+
.trim();
|
|
10926
|
+
blocks.push({
|
|
10927
|
+
startIndex,
|
|
10928
|
+
endIndex,
|
|
10929
|
+
block,
|
|
10930
|
+
score: inner.length,
|
|
10931
|
+
});
|
|
10932
|
+
cursor = endIndex;
|
|
10933
|
+
}
|
|
10934
|
+
return blocks;
|
|
10935
|
+
}
|
|
10936
|
+
async function collapseDuplicateTaggedBlocks({ targetPath, startPattern, endPattern, }) {
|
|
10937
|
+
if (!(await pathExists(targetPath)))
|
|
10938
|
+
return { changed: false };
|
|
10939
|
+
const content = await readFile(targetPath, "utf8");
|
|
10940
|
+
const blocks = collectTaggedBlocks(content, startPattern, endPattern);
|
|
10941
|
+
if (blocks.length <= 1)
|
|
10942
|
+
return { changed: false };
|
|
10943
|
+
const bestBlock = [...blocks].sort((a, b) => b.score - a.score)[0];
|
|
10944
|
+
const first = blocks[0];
|
|
10945
|
+
const last = blocks[blocks.length - 1];
|
|
10946
|
+
const normalized = content.slice(0, first.startIndex) +
|
|
10947
|
+
bestBlock.block +
|
|
10948
|
+
content.slice(last.endIndex);
|
|
10949
|
+
if (normalized === content)
|
|
10950
|
+
return { changed: false };
|
|
10951
|
+
await writeFile(targetPath, normalized, "utf8");
|
|
10952
|
+
return { changed: true };
|
|
10953
|
+
}
|
|
10954
|
+
async function normalizeArchitectureBuildOutputs(scaffold) {
|
|
10955
|
+
await collapseDuplicateTaggedBlocks({
|
|
10956
|
+
targetPath: scaffold.productPath,
|
|
10957
|
+
startPattern: PRODUCT_FOUNDATION_BLOCK_START_RE,
|
|
10958
|
+
endPattern: PRODUCT_FOUNDATION_BLOCK_END_RE,
|
|
10959
|
+
});
|
|
10960
|
+
await collapseDuplicateTaggedBlocks({
|
|
10961
|
+
targetPath: scaffold.architectureDocPath,
|
|
10962
|
+
startPattern: ARCHITECTURE_DOC_BLOCK_START_RE,
|
|
10963
|
+
endPattern: ARCHITECTURE_DOC_BLOCK_END_RE,
|
|
10964
|
+
});
|
|
10965
|
+
await collapseDuplicateTaggedBlocks({
|
|
10966
|
+
targetPath: scaffold.techMdPath,
|
|
10967
|
+
startPattern: TECH_ARCHITECTURE_BLOCK_START_RE,
|
|
10968
|
+
endPattern: TECH_ARCHITECTURE_BLOCK_END_RE,
|
|
10969
|
+
});
|
|
10970
|
+
}
|
|
10901
10971
|
async function readArchitectureDriftStatus(workspaceRoot, snapshot) {
|
|
10902
10972
|
const productPath = path.join(workspaceRoot, FOUNDATION_DOCS_DIR, "PRODUCT.md");
|
|
10903
10973
|
const architecturePath = path.join(workspaceRoot, FOUNDATION_DOCS_DIR, "ARCHITECTURE.md");
|
|
@@ -11072,6 +11142,7 @@ async function runBuildArchitecture(options) {
|
|
|
11072
11142
|
if (!execution.ok) {
|
|
11073
11143
|
throw new Error(explainArchitectureBuildFailure(platform, execution));
|
|
11074
11144
|
}
|
|
11145
|
+
await normalizeArchitectureBuildOutputs(scaffold);
|
|
11075
11146
|
const filesAfter = await captureFileContents(managedFilePaths);
|
|
11076
11147
|
const changedFiles = managedFilePaths
|
|
11077
11148
|
.filter((filePath) => filesBefore[filePath] !== filesAfter[filePath])
|