halfcycle 0.5.2 → 0.5.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/.claude-plugin/plugin.json +1 -1
- package/bin/bin.bundle.mjs +262 -3
- package/dist/cli.js +136 -100
- package/dist/cli.js.map +3 -3
- package/dist/index.js +72 -40
- package/dist/index.js.map +3 -3
- package/dist/review.d.ts +3 -3
- package/dist/review.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -3160,16 +3160,43 @@ var ownerWaitDeclarationSchema = z23.object({
|
|
|
3160
3160
|
var ownerWaitDeclarationsSchema = z23.object({ declarations: z23.array(ownerWaitDeclarationSchema) }).strict();
|
|
3161
3161
|
var OWNER_WAIT_TOO_MANY = `This project already has ${String(OWNER_WAIT_ADDITIONS_MAX)} things added to what waits for the owner. Ask the owner to take one off on their settings page in the console first; it cannot be done by typing in chat.`;
|
|
3162
3162
|
|
|
3163
|
-
// ../events/dist/
|
|
3163
|
+
// ../events/dist/owner-wait-answer.js
|
|
3164
3164
|
import { z as z24 } from "zod";
|
|
3165
|
+
var ownerWaitShortIdSchema = z24.string().regex(/^[0-9a-f]{8}$/);
|
|
3166
|
+
var OWNER_WAIT_ANSWER_ACTS = ["approve", "decline"];
|
|
3167
|
+
var ownerWaitAnswerActSchema = z24.enum(OWNER_WAIT_ANSWER_ACTS);
|
|
3168
|
+
var ownerWaitChatRequestSchema = z24.discriminatedUnion("act", [
|
|
3169
|
+
z24.object({ act: z24.literal("approve"), wait: ownerWaitShortIdSchema }).strict(),
|
|
3170
|
+
z24.object({ act: z24.literal("decline"), wait: ownerWaitShortIdSchema, note: scopeNoteWireSchema }).strict()
|
|
3171
|
+
]);
|
|
3172
|
+
function bareOutcome(outcome) {
|
|
3173
|
+
return z24.object({ outcome: z24.literal(outcome) }).strict();
|
|
3174
|
+
}
|
|
3175
|
+
var ownerWaitChatResultSchema = z24.discriminatedUnion("outcome", [
|
|
3176
|
+
z24.object({
|
|
3177
|
+
outcome: z24.literal("recorded"),
|
|
3178
|
+
act: ownerWaitAnswerActSchema,
|
|
3179
|
+
question: z24.string().min(1)
|
|
3180
|
+
}).strict(),
|
|
3181
|
+
z24.object({ outcome: z24.literal("refused"), problems: z24.array(systemDescriptionProblemSchema).min(1) }).strict(),
|
|
3182
|
+
bareOutcome("not-owner"),
|
|
3183
|
+
bareOutcome("no-owner"),
|
|
3184
|
+
bareOutcome("not-found"),
|
|
3185
|
+
bareOutcome("ambiguous"),
|
|
3186
|
+
bareOutcome("not-offered"),
|
|
3187
|
+
bareOutcome("unavailable")
|
|
3188
|
+
]);
|
|
3189
|
+
|
|
3190
|
+
// ../events/dist/autonomy.js
|
|
3191
|
+
import { z as z25 } from "zod";
|
|
3165
3192
|
var AUTONOMY_CHANGED_IN = ["console", "chat"];
|
|
3166
|
-
var autonomyChangedInSchema =
|
|
3167
|
-
var autonomySettingsSchema =
|
|
3168
|
-
on:
|
|
3193
|
+
var autonomyChangedInSchema = z25.enum(AUTONOMY_CHANGED_IN);
|
|
3194
|
+
var autonomySettingsSchema = z25.object({
|
|
3195
|
+
on: z25.boolean(),
|
|
3169
3196
|
// whether builds run on their own
|
|
3170
|
-
mayPublish:
|
|
3197
|
+
mayPublish: z25.boolean(),
|
|
3171
3198
|
// whether builds may publish or release without waiting
|
|
3172
|
-
maySpend:
|
|
3199
|
+
maySpend: z25.boolean(),
|
|
3173
3200
|
// whether builds may spend money or sign up without waiting
|
|
3174
3201
|
changedAt: utcIso8601.nullable(),
|
|
3175
3202
|
// when the setting last changed; null if never
|
|
@@ -3179,37 +3206,37 @@ var autonomySettingsSchema = z24.object({
|
|
|
3179
3206
|
message: "says when and where it changed, or neither",
|
|
3180
3207
|
path: ["changedIn"]
|
|
3181
3208
|
});
|
|
3182
|
-
var autonomyChangeRequestSchema =
|
|
3183
|
-
on:
|
|
3209
|
+
var autonomyChangeRequestSchema = z25.object({
|
|
3210
|
+
on: z25.boolean(),
|
|
3184
3211
|
// the switch
|
|
3185
|
-
mayPublish:
|
|
3212
|
+
mayPublish: z25.boolean(),
|
|
3186
3213
|
// the publish box
|
|
3187
|
-
maySpend:
|
|
3214
|
+
maySpend: z25.boolean()
|
|
3188
3215
|
// the spend box
|
|
3189
3216
|
}).strict();
|
|
3190
3217
|
var AUTONOMY_CHAT_ACTS = ["on", "off"];
|
|
3191
|
-
var autonomyChatActSchema =
|
|
3192
|
-
var autonomyChatRequestSchema =
|
|
3218
|
+
var autonomyChatActSchema = z25.enum(AUTONOMY_CHAT_ACTS);
|
|
3219
|
+
var autonomyChatRequestSchema = z25.object({
|
|
3193
3220
|
act: autonomyChatActSchema
|
|
3194
3221
|
// what the owner typed
|
|
3195
3222
|
}).strict();
|
|
3196
|
-
var autonomyChatResultSchema =
|
|
3197
|
-
|
|
3198
|
-
outcome:
|
|
3199
|
-
on:
|
|
3223
|
+
var autonomyChatResultSchema = z25.discriminatedUnion("outcome", [
|
|
3224
|
+
z25.object({
|
|
3225
|
+
outcome: z25.literal("recorded"),
|
|
3226
|
+
on: z25.boolean()
|
|
3200
3227
|
// whether builds now run on their own
|
|
3201
3228
|
}).strict(),
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3229
|
+
z25.object({ outcome: z25.literal("not-owner") }).strict(),
|
|
3230
|
+
z25.object({ outcome: z25.literal("no-owner") }).strict(),
|
|
3231
|
+
z25.object({ outcome: z25.literal("not-offered") }).strict(),
|
|
3232
|
+
z25.object({ outcome: z25.literal("unavailable") }).strict()
|
|
3206
3233
|
]);
|
|
3207
|
-
var autonomyStateSchema =
|
|
3208
|
-
on:
|
|
3234
|
+
var autonomyStateSchema = z25.object({
|
|
3235
|
+
on: z25.boolean(),
|
|
3209
3236
|
// whether builds run on their own
|
|
3210
|
-
mayPublish:
|
|
3237
|
+
mayPublish: z25.boolean(),
|
|
3211
3238
|
// whether builds may publish or release without waiting
|
|
3212
|
-
maySpend:
|
|
3239
|
+
maySpend: z25.boolean()
|
|
3213
3240
|
// whether builds may spend money or sign up without waiting
|
|
3214
3241
|
}).strict();
|
|
3215
3242
|
var autonomyStateFileSchema = autonomyStateSchema.extend({
|
|
@@ -3218,8 +3245,8 @@ var autonomyStateFileSchema = autonomyStateSchema.extend({
|
|
|
3218
3245
|
}).strict();
|
|
3219
3246
|
var AUTONOMY_STATE_FILE_MAX_AGE_MS = 24 * 60 * 60 * 1e3;
|
|
3220
3247
|
var AUTONOMY_ACTIVITY_KINDS = ["went-ahead", "waiting", "approved", "closed", "waiting-on-owner"];
|
|
3221
|
-
var autonomyActivityKindSchema =
|
|
3222
|
-
var autonomyActivityRowSchema =
|
|
3248
|
+
var autonomyActivityKindSchema = z25.enum(AUTONOMY_ACTIVITY_KINDS);
|
|
3249
|
+
var autonomyActivityRowSchema = z25.object({
|
|
3223
3250
|
kind: autonomyActivityKindSchema,
|
|
3224
3251
|
// what happened
|
|
3225
3252
|
phase: scopePhaseSchema,
|
|
@@ -3232,6 +3259,8 @@ var autonomyActivityRowSchema = z24.object({
|
|
|
3232
3259
|
// whether the agent says it can be undone
|
|
3233
3260
|
how: statementText(STATEMENT_MAX).optional(),
|
|
3234
3261
|
// how to undo it, when it can be
|
|
3262
|
+
wait: ownerWaitShortIdSchema.optional(),
|
|
3263
|
+
// the short id the owner types to answer a waiting decision
|
|
3235
3264
|
at: utcIso8601
|
|
3236
3265
|
// when it happened
|
|
3237
3266
|
}).strict().superRefine((row, ctx) => {
|
|
@@ -3258,6 +3287,9 @@ var autonomyActivityRowSchema = z24.object({
|
|
|
3258
3287
|
});
|
|
3259
3288
|
}
|
|
3260
3289
|
}
|
|
3290
|
+
if (row.kind !== "waiting" && row.wait !== void 0) {
|
|
3291
|
+
ctx.addIssue({ code: "custom", message: "only a waiting decision is answered by typing", path: ["wait"] });
|
|
3292
|
+
}
|
|
3261
3293
|
if (row.kind === "waiting" && (row.undoable !== void 0 || row.how !== void 0)) {
|
|
3262
3294
|
ctx.addIssue({ code: "custom", message: "a waiting decision has not been made yet", path: ["undoable"] });
|
|
3263
3295
|
}
|
|
@@ -3265,11 +3297,11 @@ var autonomyActivityRowSchema = z24.object({
|
|
|
3265
3297
|
ctx.addIssue({ code: "custom", message: "says how to undo it exactly when it can be undone", path: ["how"] });
|
|
3266
3298
|
}
|
|
3267
3299
|
});
|
|
3268
|
-
var autonomyActivitySchema =
|
|
3269
|
-
rows:
|
|
3300
|
+
var autonomyActivitySchema = z25.object({
|
|
3301
|
+
rows: z25.array(autonomyActivityRowSchema)
|
|
3270
3302
|
// newest first
|
|
3271
3303
|
}).strict();
|
|
3272
|
-
var savedIdSchema =
|
|
3304
|
+
var savedIdSchema = z25.string().min(1).max(64).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, "must be lower-case letters, digits and single hyphens");
|
|
3273
3305
|
var SAVED_REF_PREFIX = "refs/halfcycle/saved/";
|
|
3274
3306
|
function savedRefOf(id) {
|
|
3275
3307
|
return `${SAVED_REF_PREFIX}${id}`;
|
|
@@ -3290,33 +3322,33 @@ function isGitFolderSegment(segment) {
|
|
|
3290
3322
|
return t === ".git" || /^git~\d+$/.test(t);
|
|
3291
3323
|
}
|
|
3292
3324
|
var SAVED_PATH_KEPT_IN = ["commit", "copy"];
|
|
3293
|
-
var savedPathSchema =
|
|
3294
|
-
path:
|
|
3325
|
+
var savedPathSchema = z25.object({
|
|
3326
|
+
path: z25.string().max(4096).refine(isProjectRelativePath, { message: "must be a path inside the project" }),
|
|
3295
3327
|
// the file, relative to the project
|
|
3296
|
-
keptIn:
|
|
3328
|
+
keptIn: z25.enum(SAVED_PATH_KEPT_IN)
|
|
3297
3329
|
// in the save's commit, or copied beside this file
|
|
3298
3330
|
}).strict();
|
|
3299
|
-
var savedCommitSchema =
|
|
3300
|
-
var savedBranchSchema =
|
|
3301
|
-
name:
|
|
3331
|
+
var savedCommitSchema = z25.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/, "must be a full commit hash");
|
|
3332
|
+
var savedBranchSchema = z25.object({
|
|
3333
|
+
name: z25.string().min(1).max(255).refine((n) => !hasControlCharacter(n) && !n.startsWith("-") && !n.includes("..") && n !== "HEAD", {
|
|
3302
3334
|
message: "must be a branch name"
|
|
3303
3335
|
}),
|
|
3304
3336
|
// the branch's name
|
|
3305
3337
|
commit: savedCommitSchema
|
|
3306
3338
|
// the commit it pointed at
|
|
3307
3339
|
}).strict();
|
|
3308
|
-
var savedSchema =
|
|
3340
|
+
var savedSchema = z25.object({
|
|
3309
3341
|
id: savedIdSchema,
|
|
3310
3342
|
// what restore is typed with
|
|
3311
3343
|
savedAt: utcIso8601,
|
|
3312
3344
|
// when the copy was made
|
|
3313
|
-
ref:
|
|
3345
|
+
ref: z25.string().min(1),
|
|
3314
3346
|
// where the saved commit is kept
|
|
3315
|
-
what:
|
|
3347
|
+
what: z25.string().min(1).max(2e3),
|
|
3316
3348
|
// what the action would have changed, in words
|
|
3317
|
-
paths:
|
|
3349
|
+
paths: z25.array(savedPathSchema),
|
|
3318
3350
|
// every saved file
|
|
3319
|
-
branches:
|
|
3351
|
+
branches: z25.array(savedBranchSchema)
|
|
3320
3352
|
// every saved line of work
|
|
3321
3353
|
}).strict().refine((s) => s.ref === savedRefOf(s.id), { message: "must be the ref of this save", path: ["ref"] });
|
|
3322
3354
|
function autonomyC8(agent, question, chose) {
|