autark-cli 0.1.1 → 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 +30 -7
- package/package.json +1 -1
package/autark.mjs
CHANGED
|
@@ -97,13 +97,15 @@ async function productUpsert(rest) {
|
|
|
97
97
|
const opts = parseArgs(rest)
|
|
98
98
|
const slug = required(opts.slug, '--slug')
|
|
99
99
|
const name = required(opts.name, '--name')
|
|
100
|
-
const
|
|
100
|
+
const body = {
|
|
101
101
|
slug,
|
|
102
102
|
name,
|
|
103
103
|
url: opts.url || '',
|
|
104
104
|
tagline: opts.tagline || '',
|
|
105
|
-
visibility: opts.visibility || '
|
|
106
|
-
}
|
|
105
|
+
visibility: opts.visibility || 'private',
|
|
106
|
+
}
|
|
107
|
+
if (opts.brief !== undefined) body.brief = readValue(opts.brief)
|
|
108
|
+
const result = await api('POST', '/v1/products', body)
|
|
107
109
|
console.log(result.id)
|
|
108
110
|
}
|
|
109
111
|
|
|
@@ -188,10 +190,31 @@ async function logAction(rest) {
|
|
|
188
190
|
|
|
189
191
|
async function context(rest) {
|
|
190
192
|
const opts = parseArgs(rest)
|
|
191
|
-
const ref = required(opts._[0] || opts.hypothesis, 'hypothesis (e.g. chrome-relay/H01)')
|
|
192
|
-
const
|
|
193
|
-
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
|
+
}
|
|
194
216
|
|
|
217
|
+
const result = await api('GET', `/v1/context/${encodeURIComponent(productSlug)}/${encodeURIComponent(code)}`)
|
|
195
218
|
console.log(`# ${result.product.slug}/${result.hypothesis.code} — ${result.hypothesis.title}\n`)
|
|
196
219
|
console.log(`Status: ${result.hypothesis.status}\n`)
|
|
197
220
|
console.log(result.hypothesis.hypothesis_md)
|
|
@@ -306,7 +329,7 @@ function usage() {
|
|
|
306
329
|
autark logout clear local credentials
|
|
307
330
|
autark me show signed-in user
|
|
308
331
|
|
|
309
|
-
autark product upsert --slug <slug> --name <name> [--url <url>] [--tagline <text>]
|
|
332
|
+
autark product upsert --slug <slug> --name <name> [--url <url>] [--tagline <text>] [--brief @./brief.md] [--visibility private|public]
|
|
310
333
|
autark product list
|
|
311
334
|
|
|
312
335
|
autark hypothesis create --product <slug> --code H01 --md @./hypothesis.md [--title <t>]
|
package/package.json
CHANGED