autark-cli 0.1.2 → 0.1.3
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/autark.mjs +24 -3
- package/package.json +1 -1
package/autark.mjs
CHANGED
|
@@ -190,10 +190,31 @@ async function logAction(rest) {
|
|
|
190
190
|
|
|
191
191
|
async function context(rest) {
|
|
192
192
|
const opts = parseArgs(rest)
|
|
193
|
-
const ref = required(opts._[0] || opts.hypothesis, 'hypothesis (e.g. chrome-relay/H01)')
|
|
194
|
-
const
|
|
195
|
-
const
|
|
193
|
+
const ref = required(opts._[0] || opts.hypothesis, 'product or hypothesis (e.g. chrome-relay or chrome-relay/H01)')
|
|
194
|
+
const parts = ref.split('/')
|
|
195
|
+
const productSlug = parts[0]
|
|
196
|
+
const code = parts[1]
|
|
197
|
+
|
|
198
|
+
if (!code) {
|
|
199
|
+
// product-level: brief + every hypothesis with status + counts
|
|
200
|
+
const r = await api('GET', `/v1/context/${encodeURIComponent(productSlug)}`)
|
|
201
|
+
console.log(`# ${r.product.slug} — ${r.product.name}`)
|
|
202
|
+
if (r.product.tagline) console.log(`> ${r.product.tagline}`)
|
|
203
|
+
if (r.product.url) console.log(`> ${r.product.url}`)
|
|
204
|
+
console.log(`\n## Brief\n`)
|
|
205
|
+
console.log(r.product.brief?.trim() || '(no brief set — owner can add one at https://autark.kushalsm.com)')
|
|
206
|
+
console.log(`\n## Hypotheses (${r.hypotheses.length})\n`)
|
|
207
|
+
if (!r.hypotheses.length) {
|
|
208
|
+
console.log('(none yet — start with H01)')
|
|
209
|
+
} else {
|
|
210
|
+
for (const h of r.hypotheses) {
|
|
211
|
+
console.log(`- [${h.status}] ${h.code} — ${h.title} (runs: ${h.run_count})`)
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return
|
|
215
|
+
}
|
|
196
216
|
|
|
217
|
+
const result = await api('GET', `/v1/context/${encodeURIComponent(productSlug)}/${encodeURIComponent(code)}`)
|
|
197
218
|
console.log(`# ${result.product.slug}/${result.hypothesis.code} — ${result.hypothesis.title}\n`)
|
|
198
219
|
console.log(`Status: ${result.hypothesis.status}\n`)
|
|
199
220
|
console.log(result.hypothesis.hypothesis_md)
|
package/package.json
CHANGED