@indigoai-us/hq-cli 5.342.6 → 5.342.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/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [5.342.7] — 2026-10-04
|
|
6
|
+
- Batch policy frontmatter reads into one `hq core policy frontmatter` invocation while preserving single-file output.
|
|
7
|
+
|
|
5
8
|
## [5.342.6] — 2026-10-04
|
|
6
9
|
- Add `hq mesh project member add` to add an active company member to a project.
|
|
7
10
|
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
# read-policy-frontmatter.sh — Extract YAML frontmatter from a policy file
|
|
3
3
|
#
|
|
4
4
|
# Usage: bash core/scripts/read-policy-frontmatter.sh <policy-file>
|
|
5
|
+
# bash core/scripts/read-policy-frontmatter.sh <policy-file> <policy-file> ...
|
|
5
6
|
#
|
|
6
7
|
# Returns only the YAML frontmatter block (between the first two --- markers),
|
|
7
8
|
# skipping the policy body. Used by /startwork, /plan, /brainstorm, /run commands
|
|
@@ -20,13 +21,19 @@ if [ $# -lt 1 ]; then
|
|
|
20
21
|
exit 1
|
|
21
22
|
fi
|
|
22
23
|
|
|
23
|
-
|
|
24
|
+
INDEX=0
|
|
25
|
+
for FILE in "$@"; do
|
|
26
|
+
if [ ! -r "$FILE" ]; then
|
|
27
|
+
echo "ERROR: File not readable: $FILE" >&2
|
|
28
|
+
exit 1
|
|
29
|
+
fi
|
|
24
30
|
|
|
25
|
-
if [
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
if [ "$INDEX" -gt 0 ]; then
|
|
32
|
+
printf '\n# --- policy-file: %s ---\n' "$FILE"
|
|
33
|
+
fi
|
|
34
|
+
INDEX=$((INDEX + 1))
|
|
29
35
|
|
|
30
|
-
# Extract frontmatter: lines between first two --- markers.
|
|
31
|
-
# c counts --- markers; print lines only while inside the frontmatter (c==1).
|
|
32
|
-
awk '/^---$/{c++; next} c==1' "$FILE"
|
|
36
|
+
# Extract frontmatter: lines between first two --- markers.
|
|
37
|
+
# c counts --- markers; print lines only while inside the frontmatter (c==1).
|
|
38
|
+
awk '/^---$/{c++; next} c==1' "$FILE"
|
|
39
|
+
done
|
|
@@ -2,37 +2,58 @@ import * as fs from 'node:fs';
|
|
|
2
2
|
import * as path from 'node:path';
|
|
3
3
|
import { usesGnuAwk } from '../lib/core-utils/awk-diagnostics.js';
|
|
4
4
|
const USAGE = Buffer.from('USAGE: read-policy-frontmatter.sh <policy-file>\n');
|
|
5
|
+
const MULTI_FILE_SEPARATOR = (file) => Buffer.from(`\n# --- policy-file: ${file} ---\n`);
|
|
5
6
|
/** Byte-preserving port of core/scripts/read-policy-frontmatter.sh. */
|
|
6
7
|
export function runPolicyFrontmatter(args, cwd, pathValue = process.env.PATH, platform = process.platform) {
|
|
7
|
-
|
|
8
|
-
if (first === undefined)
|
|
8
|
+
if (args.length === 0)
|
|
9
9
|
return { code: 1, stdout: Buffer.alloc(0), stderr: USAGE };
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
:
|
|
25
|
-
|
|
10
|
+
const output = [];
|
|
11
|
+
const diagnostics = [];
|
|
12
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
13
|
+
const file = args[index];
|
|
14
|
+
const filePath = path.isAbsolute(file) ? file : path.resolve(cwd, file);
|
|
15
|
+
try {
|
|
16
|
+
fs.accessSync(filePath, fs.constants.R_OK);
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
const code = error.code;
|
|
20
|
+
if (code === 'ENOENT' || code === 'ENOTDIR' || code === 'EACCES' || code === 'ELOOP') {
|
|
21
|
+
return {
|
|
22
|
+
code: 1,
|
|
23
|
+
stdout: Buffer.concat(output),
|
|
24
|
+
stderr: Buffer.concat([...diagnostics, Buffer.from(`ERROR: File not readable: ${file}\n`)]),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
throw error;
|
|
26
28
|
}
|
|
27
|
-
if (
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
};
|
|
29
|
+
if (index > 0)
|
|
30
|
+
output.push(MULTI_FILE_SEPARATOR(file));
|
|
31
|
+
let source;
|
|
32
|
+
try {
|
|
33
|
+
source = fs.readFileSync(filePath);
|
|
33
34
|
}
|
|
34
|
-
|
|
35
|
+
catch (error) {
|
|
36
|
+
const code = error.code;
|
|
37
|
+
if (code === 'EISDIR') {
|
|
38
|
+
if (usesGnuAwk(pathValue, platform)) {
|
|
39
|
+
diagnostics.push(Buffer.from(`awk: warning: command line argument \`${file}' is a directory: skipped\n`));
|
|
40
|
+
}
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
if (code === 'ENOENT' || code === 'ENOTDIR' || code === 'EACCES' || code === 'ELOOP') {
|
|
44
|
+
return {
|
|
45
|
+
code: 1,
|
|
46
|
+
stdout: Buffer.concat(output),
|
|
47
|
+
stderr: Buffer.concat([...diagnostics, Buffer.from(`ERROR: File not readable: ${file}\n`)]),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
52
|
+
output.push(extractFrontmatter(source, platform));
|
|
35
53
|
}
|
|
54
|
+
return { code: 0, stdout: Buffer.concat(output), stderr: Buffer.concat(diagnostics) };
|
|
55
|
+
}
|
|
56
|
+
function extractFrontmatter(source, platform) {
|
|
36
57
|
const output = [];
|
|
37
58
|
let markers = 0;
|
|
38
59
|
let start = 0;
|
|
@@ -53,6 +74,6 @@ export function runPolicyFrontmatter(args, cwd, pathValue = process.env.PATH, pl
|
|
|
53
74
|
break;
|
|
54
75
|
start = end + 1;
|
|
55
76
|
}
|
|
56
|
-
return
|
|
77
|
+
return Buffer.concat(output);
|
|
57
78
|
}
|
|
58
79
|
//# sourceMappingURL=core-policy-frontmatter.js.map
|