@brainjar/cli 0.6.2 → 0.6.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/package.json +1 -1
- package/src/commands/persona.ts +4 -4
- package/src/commands/rules.ts +3 -3
- package/src/commands/soul.ts +4 -4
package/package.json
CHANGED
package/src/commands/persona.ts
CHANGED
|
@@ -167,7 +167,7 @@ export const persona = Cli.create('persona', {
|
|
|
167
167
|
options: z.object({
|
|
168
168
|
project: z.boolean().default(false).describe('Show project persona override (if any)'),
|
|
169
169
|
short: z.boolean().default(false).describe('Print only the active persona name'),
|
|
170
|
-
|
|
170
|
+
rev: z.number().optional().describe('Show a specific version from history'),
|
|
171
171
|
}),
|
|
172
172
|
async run(c) {
|
|
173
173
|
const api = await getApi()
|
|
@@ -178,11 +178,11 @@ export const persona = Cli.create('persona', {
|
|
|
178
178
|
return state.persona ?? 'none'
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
-
if (c.options.
|
|
181
|
+
if (c.options.rev) {
|
|
182
182
|
const name = c.args.name
|
|
183
|
-
if (!name) throw createError(ErrorCode.MISSING_ARG, { message: 'Name is required when using --
|
|
183
|
+
if (!name) throw createError(ErrorCode.MISSING_ARG, { message: 'Name is required when using --rev' })
|
|
184
184
|
const slug = normalizeSlug(name, 'persona name')
|
|
185
|
-
const v = await api.get<ApiContentVersion>(`/api/v1/personas/${slug}/versions/${c.options.
|
|
185
|
+
const v = await api.get<ApiContentVersion>(`/api/v1/personas/${slug}/versions/${c.options.rev}`)
|
|
186
186
|
return { name: slug, version: v.version, content: v.content, metadata: v.metadata, created_at: v.created_at }
|
|
187
187
|
}
|
|
188
188
|
|
package/src/commands/rules.ts
CHANGED
|
@@ -146,14 +146,14 @@ export const rules = Cli.create('rules', {
|
|
|
146
146
|
name: z.string().describe('Rule name to show'),
|
|
147
147
|
}),
|
|
148
148
|
options: z.object({
|
|
149
|
-
|
|
149
|
+
rev: z.number().optional().describe('Show a specific version from history'),
|
|
150
150
|
}),
|
|
151
151
|
async run(c) {
|
|
152
152
|
const name = normalizeSlug(c.args.name, 'rule name')
|
|
153
153
|
const api = await getApi()
|
|
154
154
|
|
|
155
|
-
if (c.options.
|
|
156
|
-
const v = await api.get<ApiContentVersion>(`/api/v1/rules/${name}/versions/${c.options.
|
|
155
|
+
if (c.options.rev) {
|
|
156
|
+
const v = await api.get<ApiContentVersion>(`/api/v1/rules/${name}/versions/${c.options.rev}`)
|
|
157
157
|
const entries = (v.metadata as { entries?: Array<{ sort_key: number; content: string }> })?.entries ?? []
|
|
158
158
|
const content = entries.map(e => e.content.trim()).join('\n\n')
|
|
159
159
|
return { name, version: v.version, content, created_at: v.created_at }
|
package/src/commands/soul.ts
CHANGED
|
@@ -133,7 +133,7 @@ export const soul = Cli.create('soul', {
|
|
|
133
133
|
options: z.object({
|
|
134
134
|
project: z.boolean().default(false).describe('Show project soul override (if any)'),
|
|
135
135
|
short: z.boolean().default(false).describe('Print only the active soul name'),
|
|
136
|
-
|
|
136
|
+
rev: z.number().optional().describe('Show a specific version from history'),
|
|
137
137
|
}),
|
|
138
138
|
async run(c) {
|
|
139
139
|
const api = await getApi()
|
|
@@ -144,11 +144,11 @@ export const soul = Cli.create('soul', {
|
|
|
144
144
|
return state.soul ?? 'none'
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
if (c.options.
|
|
147
|
+
if (c.options.rev) {
|
|
148
148
|
const name = c.args.name
|
|
149
|
-
if (!name) throw createError(ErrorCode.MISSING_ARG, { message: 'Name is required when using --
|
|
149
|
+
if (!name) throw createError(ErrorCode.MISSING_ARG, { message: 'Name is required when using --rev' })
|
|
150
150
|
const slug = normalizeSlug(name, 'soul name')
|
|
151
|
-
const v = await api.get<ApiContentVersion>(`/api/v1/souls/${slug}/versions/${c.options.
|
|
151
|
+
const v = await api.get<ApiContentVersion>(`/api/v1/souls/${slug}/versions/${c.options.rev}`)
|
|
152
152
|
return { name: slug, version: v.version, content: v.content, created_at: v.created_at }
|
|
153
153
|
}
|
|
154
154
|
|