@lsctech/polaris 0.3.12 → 0.3.13

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.
@@ -132,18 +132,30 @@ If no doctrine docs are relevant, return an empty array for relevant_docs.`;
132
132
  cwd: repoRoot,
133
133
  });
134
134
  const stdout = (result.stdout ?? "").trim();
135
+ // Try single-line JSON first (ideal case)
135
136
  const jsonLine = stdout
136
137
  .split("\n")
137
138
  .reverse()
138
139
  .find((l) => l.trim().startsWith("{") && l.includes("relevant_docs"));
139
- if (!jsonLine)
140
- return null;
141
- try {
142
- return JSON.parse(jsonLine);
140
+ if (jsonLine) {
141
+ try {
142
+ return JSON.parse(jsonLine);
143
+ }
144
+ catch {
145
+ // fall through to block extraction
146
+ }
143
147
  }
144
- catch {
145
- return null;
148
+ // Try extracting JSON block (handles multi-line or code-fenced output)
149
+ const blockMatch = stdout.match(/\{[\s\S]*"relevant_docs"[\s\S]*\}/);
150
+ if (blockMatch) {
151
+ try {
152
+ return JSON.parse(blockMatch[0]);
153
+ }
154
+ catch {
155
+ return null;
156
+ }
146
157
  }
158
+ return null;
147
159
  }
148
160
  async function enrichCanonFiles(repoRoot) {
149
161
  let config = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lsctech/polaris",
3
- "version": "0.3.12",
3
+ "version": "0.3.13",
4
4
  "description": "Polaris — standalone taskchain orchestration framework for governed AI agent workflows",
5
5
  "bin": {
6
6
  "polaris-cli": "dist/cli/index.js"