@link-assistant/hive-mind 1.2.3 → 1.2.4

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
@@ -1,5 +1,22 @@
1
1
  # @link-assistant/hive-mind
2
2
 
3
+ ## 1.2.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 14ea4b6: Add validation for LINO configuration to detect invalid input
8
+ - Add validation in `lenv-reader.lib.mjs` to reject multiple values on the same line (e.g., `--option1 --option2`)
9
+ - Add validation to reject unrecognized characters in command-line options (e.g., `?`, `@`, `!`)
10
+ - Errors include clear messages showing the problematic value and instructions for correction
11
+ - Valid option characters: letters, numbers, hyphens, underscores, equals signs
12
+ - Add comprehensive unit tests for LINO parsing logic (`test-lino.mjs`)
13
+ - Add validation tests to lenv-reader test suite (`test-lenv-reader.mjs`)
14
+ - Add lino tests to CI/CD workflow
15
+
16
+ This approach helps users identify and correct configuration errors early, rather than silently dropping invalid options.
17
+
18
+ Fixes #1086
19
+
3
20
  ## 1.2.3
4
21
 
5
22
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@link-assistant/hive-mind",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "description": "AI-powered issue solver and hive mind for collaborative problem solving",
5
5
  "main": "src/hive.mjs",
6
6
  "type": "module",
@@ -77,6 +77,47 @@ export class LenvReader {
77
77
 
78
78
  // The values are the variable value
79
79
  if (link.values && link.values.length > 0) {
80
+ // Check for nested structures (multiple items on same line) - reject with error
81
+ // A nested tuple with id=null that appears amongst other direct values indicates
82
+ // same-line grouping (e.g., "--option1 --option2" on same line)
83
+ // However, if the entire list is a SINGLE nested tuple (e.g., "VAR: (\n 1\n 2\n)"),
84
+ // that's valid parenthesized syntax
85
+ const hasDirectValues = link.values.some(v => v && typeof v === 'object' && v.id !== null);
86
+ const hasNestedTuples = link.values.some(v => v && typeof v === 'object' && v.id === null && v.values && v.values.length > 0);
87
+
88
+ if (hasDirectValues && hasNestedTuples) {
89
+ // Mixed direct values and nested tuples indicates same-line grouping
90
+ for (const v of link.values) {
91
+ if (v && typeof v === 'object' && v.id === null && v.values && v.values.length > 0) {
92
+ const nestedItems = v.values.map(nested => nested.id || nested).join(' ');
93
+ throw new Error(`Invalid LINO format in "${varName}": Multiple values on the same line are not supported.\n` + `Found: "${nestedItems}"\n` + `Each value must be on its own line with proper indentation.`);
94
+ }
95
+ }
96
+ }
97
+
98
+ // Determine which values to validate for invalid characters
99
+ // If it's a single nested tuple (parenthesized list), unwrap it for validation
100
+ let valuesToValidate = link.values;
101
+ if (link.values.length === 1 && link.values[0] && typeof link.values[0] === 'object' && link.values[0].id === null && link.values[0].values) {
102
+ // Single parenthesized list - use inner values
103
+ valuesToValidate = link.values[0].values;
104
+ }
105
+
106
+ // Check for invalid characters in option-like values
107
+ for (const v of valuesToValidate) {
108
+ // Options should match pattern: --option-name or -o (with optional =value)
109
+ const valueStr = v.id || v;
110
+ if (typeof valueStr === 'string' && valueStr.startsWith('-')) {
111
+ // This looks like a command-line option, validate it
112
+ // Valid option pattern: -x, --option-name, --option-name=value
113
+ // Invalid characters: ?, !, @, #, $, %, ^, &, *, etc.
114
+ const invalidCharMatch = valueStr.match(/[^a-zA-Z0-9=_.-]/);
115
+ if (invalidCharMatch) {
116
+ throw new Error(`Invalid LINO format in "${varName}": Unrecognized character "${invalidCharMatch[0]}" in option.\n` + `Found: "${valueStr}"\n` + `Options should only contain letters, numbers, hyphens, underscores, and equals signs.`);
117
+ }
118
+ }
119
+ }
120
+
80
121
  // If there are multiple values, format them as LINO notation
81
122
  const values = link.values.map(v => v.id || v);
82
123
 
@@ -98,6 +139,11 @@ export class LenvReader {
98
139
 
99
140
  return result;
100
141
  } catch (error) {
142
+ // Re-throw validation errors so users can correct their configuration
143
+ if (error.message.includes('Invalid LINO format')) {
144
+ throw error;
145
+ }
146
+ // For other parsing errors, log and return empty
101
147
  console.error(`Error parsing LINO configuration: ${error.message}`);
102
148
  return {};
103
149
  }