genesis-compiler 1.7.6 → 1.7.7
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/README.md
CHANGED
|
@@ -946,7 +946,13 @@ detailed Machine City and simple Program City projections.
|
|
|
946
946
|
public non-secret defaults, value-free missing-input diagnostics, and dotenv
|
|
947
947
|
projection paths without returning any supplied environment value.
|
|
948
948
|
`inspectStackSection()` returns one exact consumer-owned section without
|
|
949
|
-
interpreting or executing its contents.
|
|
949
|
+
interpreting or executing its contents. Its default `rootMode: "repository"`
|
|
950
|
+
uses Git discovery. For an authorized source snapshot without Git metadata,
|
|
951
|
+
hosts may pass `rootMode: "directory"` and an explicit absolute `projectRoot`.
|
|
952
|
+
This reads that exact directory, including when it sits inside another Git
|
|
953
|
+
repository. It retains the same Stack validation and performs no writes or
|
|
954
|
+
commands. Missing/invalid roots fail; this is never an automatic fallback from
|
|
955
|
+
Git ownership or discovery errors.
|
|
950
956
|
|
|
951
957
|
Hosts that already validate access to a shared worktree may wrap an operation
|
|
952
958
|
in `withTrustedGitRepository(absoluteWorktreeRoot, () => inspectEnvironment({
|
package/docs/stack-components.md
CHANGED
|
@@ -177,6 +177,13 @@ The named consumer then owns all interpretation and action. This boundary works
|
|
|
177
177
|
equally for web applications, libraries, command-line tools, native programs,
|
|
178
178
|
firmware, desktop software, and future systems Genesis has never seen.
|
|
179
179
|
|
|
180
|
+
The library can inspect a source snapshot without Git metadata with
|
|
181
|
+
`inspectStackSection({ name, projectRoot: absoluteDirectory, rootMode: "directory" })`.
|
|
182
|
+
It uses the exact directory and the same Stack parser without repository
|
|
183
|
+
discovery. Default library and CLI inspection continue to use the enclosing
|
|
184
|
+
Git repository and its trust checks. Invalid modes or directory roots fail;
|
|
185
|
+
there is no automatic fallback.
|
|
186
|
+
|
|
180
187
|
## Selection and identity
|
|
181
188
|
|
|
182
189
|
`genesis stack add` records selected packages and component dependency closure,
|
package/package.json
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { realpath, stat } from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
|
|
1
4
|
import { GENESIS_CONTRACTS } from './contracts.js';
|
|
2
5
|
import { gitContext } from './git.js';
|
|
3
6
|
import { readStack } from './stack.js';
|
|
@@ -8,10 +11,22 @@ import { sha256, stableJson } from './utils.js';
|
|
|
8
11
|
export async function inspectProjectStackSection({
|
|
9
12
|
name,
|
|
10
13
|
projectRoot,
|
|
14
|
+
rootMode = 'repository',
|
|
11
15
|
stackPackages = [],
|
|
12
16
|
} = {}) {
|
|
13
17
|
const sectionName = normalizeStackSectionName(name);
|
|
14
|
-
|
|
18
|
+
let root;
|
|
19
|
+
if (rootMode === 'repository') {
|
|
20
|
+
root = (await gitContext(projectRoot)).repositoryRoot;
|
|
21
|
+
} else if (rootMode === 'directory') {
|
|
22
|
+
if (typeof projectRoot !== 'string' || !path.isAbsolute(projectRoot)) {
|
|
23
|
+
throw new TypeError('Directory inspection requires an explicit absolute projectRoot.');
|
|
24
|
+
}
|
|
25
|
+
root = await realpath(projectRoot);
|
|
26
|
+
if (!(await stat(root)).isDirectory()) throw new TypeError('Directory inspection requires a directory.');
|
|
27
|
+
} else {
|
|
28
|
+
throw new TypeError('Stack section rootMode must be repository or directory.');
|
|
29
|
+
}
|
|
15
30
|
const stack = await readStack(root, { stackPackages });
|
|
16
31
|
const section = stack.extensions.find((candidate) => candidate.name === sectionName);
|
|
17
32
|
const diagnostics = [...(section?.diagnostics || [])];
|
|
@@ -30,4 +45,3 @@ export async function inspectProjectStackSection({
|
|
|
30
45
|
diagnostics,
|
|
31
46
|
};
|
|
32
47
|
}
|
|
33
|
-
|