@codetreker/daynight 0.8.1 → 0.8.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.
- package/dist/api/client.d.ts +6 -1
- package/dist/api/client.js +120 -23
- package/dist/api/client.js.map +1 -1
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.js +1 -1
- package/dist/api/index.js.map +1 -1
- package/dist/api/parse.d.ts +4 -4
- package/dist/api/parse.js +28 -4
- package/dist/api/parse.js.map +1 -1
- package/dist/api/types.d.ts +23 -1
- package/dist/cli/byte-output-helper.d.ts +1 -0
- package/dist/cli/byte-output-helper.js +48 -0
- package/dist/cli/byte-output-helper.js.map +1 -0
- package/dist/cli/byte-output.d.ts +7 -0
- package/dist/cli/byte-output.js +199 -0
- package/dist/cli/byte-output.js.map +1 -0
- package/dist/cli/cancellation.d.ts +5 -0
- package/dist/cli/cancellation.js +24 -0
- package/dist/cli/cancellation.js.map +1 -0
- package/dist/cli/commands.js +2 -0
- package/dist/cli/commands.js.map +1 -1
- package/dist/cli/context.d.ts +2 -0
- package/dist/cli/context.js +15 -9
- package/dist/cli/context.js.map +1 -1
- package/dist/cli/prompts.d.ts +16 -3
- package/dist/cli/prompts.js +38 -10
- package/dist/cli/prompts.js.map +1 -1
- package/dist/cli/schema.js +6 -6
- package/dist/cli/schema.js.map +1 -1
- package/dist/commands/review/adapters/copilot.d.ts +3 -0
- package/dist/commands/review/adapters/copilot.js +16 -7
- package/dist/commands/review/adapters/copilot.js.map +1 -1
- package/dist/commands/review/adapters/github-review-state.d.ts +21 -0
- package/dist/commands/review/adapters/github-review-state.js +144 -0
- package/dist/commands/review/adapters/github-review-state.js.map +1 -0
- package/dist/commands/review/adapters/github.d.ts +2 -1
- package/dist/commands/review/adapters/github.js +31 -4
- package/dist/commands/review/adapters/github.js.map +1 -1
- package/dist/commands/review/coordinator.js +134 -7
- package/dist/commands/review/coordinator.js.map +1 -1
- package/dist/commands/review/model.d.ts +21 -0
- package/dist/commands/review/publication.d.ts +14 -0
- package/dist/commands/review/publication.js +47 -0
- package/dist/commands/review/publication.js.map +1 -0
- package/dist/commands/review/skill.js +5 -83
- package/dist/commands/review/skill.js.map +1 -1
- package/dist/commands/review/skills/daynight-review/SKILL.md +90 -22
- package/dist/commands/review/store.d.ts +20 -0
- package/dist/commands/review/store.js +134 -5
- package/dist/commands/review/store.js.map +1 -1
- package/dist/commands/server/runtime.d.ts +1 -1
- package/dist/commands/server/runtime.js +8 -1
- package/dist/commands/server/runtime.js.map +1 -1
- package/dist/commands/skill/agents.d.ts +23 -0
- package/dist/commands/skill/agents.js +14 -0
- package/dist/commands/skill/agents.js.map +1 -0
- package/dist/commands/skill/command.d.ts +12 -0
- package/dist/commands/skill/command.js +78 -0
- package/dist/commands/skill/command.js.map +1 -0
- package/dist/commands/skill/definition.d.ts +2 -0
- package/dist/commands/skill/definition.js +12 -0
- package/dist/commands/skill/definition.js.map +1 -0
- package/dist/commands/skill/install.d.ts +13 -0
- package/dist/commands/skill/install.js +126 -0
- package/dist/commands/skill/install.js.map +1 -0
- package/dist/commands/skill/skills/using-daynight/SKILL.md +56 -0
- package/dist/commands/skill/skills/using-daynight/references/autopilot.md +71 -0
- package/dist/commands/skill/skills/using-daynight/references/create-task.md +103 -0
- package/dist/commands/skill/skills/using-daynight/references/handbook.md +72 -0
- package/dist/commands/skill/skills/using-daynight/references/run-task.md +80 -0
- package/dist/commands/skill/targets.d.ts +11 -0
- package/dist/commands/skill/targets.js +36 -0
- package/dist/commands/skill/targets.js.map +1 -0
- package/dist/commands/task/attachment-rendering.d.ts +5 -0
- package/dist/commands/task/attachment-rendering.js +38 -0
- package/dist/commands/task/attachment-rendering.js.map +1 -0
- package/dist/commands/task/attachment.d.ts +6 -0
- package/dist/commands/task/attachment.js +91 -0
- package/dist/commands/task/attachment.js.map +1 -0
- package/dist/commands/task/command.js +35 -6
- package/dist/commands/task/command.js.map +1 -1
- package/dist/commands/task/definition.js +59 -8
- package/dist/commands/task/definition.js.map +1 -1
- package/dist/commands/task/rendering.d.ts +1 -0
- package/dist/commands/task/rendering.js +25 -4
- package/dist/commands/task/rendering.js.map +1 -1
- package/dist/config/setup.js +5 -24
- package/dist/config/setup.js.map +1 -1
- package/dist/platform/skill-bundle.d.ts +10 -0
- package/dist/platform/skill-bundle.js +82 -0
- package/dist/platform/skill-bundle.js.map +1 -0
- package/dist/repository/git.d.ts +1 -0
- package/dist/repository/git.js +6 -3
- package/dist/repository/git.js.map +1 -1
- package/package.json +7 -2
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { withCliCancellation } from "../../cli/cancellation.js";
|
|
2
|
+
import { parseCommand, renderCommandHelp } from "../../cli/schema.js";
|
|
3
|
+
import { skillDefinition } from "./definition.js";
|
|
4
|
+
const defaultDependencies = {
|
|
5
|
+
detectAgents: async () => (await import("./agents.js")).detectSkillAgents(),
|
|
6
|
+
projectRoot: async (cwd, signal) => {
|
|
7
|
+
const { createOperation } = await import("../../api/operation.js");
|
|
8
|
+
const operation = createOperation({ signal, limits: { totalMs: 30_000 } });
|
|
9
|
+
try {
|
|
10
|
+
return await (await import("../../repository/git.js")).discoverWorktreeRoot(cwd, operation);
|
|
11
|
+
}
|
|
12
|
+
finally {
|
|
13
|
+
operation.dispose();
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
captureBundle: async (packageDirectory) => (await import("./install.js")).captureInstalledSkill(packageDirectory),
|
|
17
|
+
planTargets: async (...args) => (await import("./targets.js")).planSkillTargets(...args),
|
|
18
|
+
install: async (...args) => (await import("./install.js")).installSkillTargets(...args),
|
|
19
|
+
};
|
|
20
|
+
export const runSkillCommand = async (args, context, dependencies = defaultDependencies, suppliedSignal) => {
|
|
21
|
+
const command = parseCommand(skillDefinition, args, ["daynight", "skill"], "daynight skill --help");
|
|
22
|
+
if (command.kind !== "run") {
|
|
23
|
+
context.stdout(renderCommandHelp(command.command, command.path));
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
await withCliCancellation(context, async (signal) => {
|
|
27
|
+
const prompt = context.prompt;
|
|
28
|
+
if (prompt?.isInteractive !== true)
|
|
29
|
+
throw new Error("Skill installation requires terminal input and stderr. Run daynight skill install from an interactive terminal.");
|
|
30
|
+
signal.throwIfAborted();
|
|
31
|
+
const detected = await dependencies.detectAgents();
|
|
32
|
+
signal.throwIfAborted();
|
|
33
|
+
if (detected.length === 0)
|
|
34
|
+
throw new Error("No supported agent launchers were detected on PATH (codex, copilot, claude). Install an agent and run daynight skill install again.");
|
|
35
|
+
const selection = await prompt.selectMany({
|
|
36
|
+
message: "Install the using-daynight skill for which agents?",
|
|
37
|
+
choices: detected.map(({ id, name }) => ({ name, value: id })),
|
|
38
|
+
requiredMessage: "Select at least one agent.",
|
|
39
|
+
}, signal);
|
|
40
|
+
signal.throwIfAborted();
|
|
41
|
+
const agents = detected.filter(({ id }) => selection.includes(id));
|
|
42
|
+
if (agents.length === 0)
|
|
43
|
+
throw new Error("Select at least one detected agent to install the using-daynight skill.");
|
|
44
|
+
const scope = await prompt.select({
|
|
45
|
+
message: "Where should the skill be installed?",
|
|
46
|
+
choices: [{ name: "User", value: "user" }, { name: "Project", value: "project" }],
|
|
47
|
+
default: "user",
|
|
48
|
+
}, signal);
|
|
49
|
+
signal.throwIfAborted();
|
|
50
|
+
const scopeName = scope === "user" ? "User" : "Project";
|
|
51
|
+
const base = scope === "user" ? context.homeDirectory() : await dependencies.projectRoot(context.workingDirectory(), signal);
|
|
52
|
+
const bundle = await dependencies.captureBundle(context.packageDirectory);
|
|
53
|
+
const targets = await dependencies.planTargets(base, agents);
|
|
54
|
+
signal.throwIfAborted();
|
|
55
|
+
try {
|
|
56
|
+
await dependencies.install(targets, bundle, signal, (target) => {
|
|
57
|
+
for (const [index, agent] of target.agents.entries()) {
|
|
58
|
+
context.stdout(`Installed ${agent.name}: ${scopeName} using-daynight skill at ${target.path} (package ${context.version}${index === 0 ? "" : "; shared installation"}).\n${agent.reload}\n`);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
catch (cause) {
|
|
63
|
+
const { SkillInstallationError } = await import("./install.js");
|
|
64
|
+
if (cause instanceof SkillInstallationError) {
|
|
65
|
+
if (cause.failed !== undefined)
|
|
66
|
+
for (const agent of cause.failed.agents)
|
|
67
|
+
context.stderr(cause.installedAtFailedTarget
|
|
68
|
+
? `Installed ${agent.name}: ${scopeName} using-daynight skill at ${cause.failed.path}; legacy daynight cleanup failed at ${cause.failed.legacyPath}.\n`
|
|
69
|
+
: `Failed ${agent.name}: ${scopeName} using-daynight skill at ${cause.failed.path}.\n`);
|
|
70
|
+
for (const target of cause.unattempted)
|
|
71
|
+
for (const agent of target.agents)
|
|
72
|
+
context.stderr(`Not attempted ${agent.name}: ${scopeName} using-daynight skill at ${target.path}.\n`);
|
|
73
|
+
}
|
|
74
|
+
throw cause;
|
|
75
|
+
}
|
|
76
|
+
}, suppliedSignal);
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../../src/commands/skill/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAEhE,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAalD,MAAM,mBAAmB,GAA6B;IACpD,YAAY,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,iBAAiB,EAAE;IAC3E,WAAW,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE;QACjC,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,MAAM,CAAC,wBAAwB,CAAC,CAAC;QACnE,MAAM,SAAS,GAAG,eAAe,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,EAA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AAM,CAAC,KAAK,CAAC,uBAAuB;4BACnH,CAAC,CAAC,aAAa,KAAK,CAAC,IAAI,KAAK,SAAS,4BAA4B,KAAK,CAAC,MAAM,CAAC,IAAI,uCAAuC,KAAK,CAAC,MAAM,CAAC,UAAU,KAAK;4BACvJ,CAAC,CAAC,UAAU,KAAK,CAAC,IAAI,KAAK,SAAS,4BAA4B,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,CAAC;gBAC1F,KAAK,MAAM,MAAM,IAAI,KAAK,CAAC,WAAW;oBAAE,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM;wBAAE,OAAO,CAAC,MAAM,CAAC,iBAAiB,KAAK,CAAC,IAAI,KAAK,SAAS,4BAA4B,MAAM,CAAC,IAAI,KAAK,CAAC,CAAC;YACnL,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC,EAAE,cAAc,CAAC,CAAC;AACrB,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const skillDefinition = {
|
|
2
|
+
name: "skill",
|
|
3
|
+
description: "Install the using-daynight project and task skill for coding agents",
|
|
4
|
+
commands: [{
|
|
5
|
+
name: "install",
|
|
6
|
+
description: "Choose detected agents and install or replace their using-daynight skill",
|
|
7
|
+
options: [{ names: ["-h", "--help"], description: "Show this help", action: "help" }],
|
|
8
|
+
details: "Requires interactive terminal input and stderr. Choose agents, then User or Project scope.\nReplaces the complete using-daynight skill directory, including local edits and obsolete files. Removes the selected scope's legacy daynight skill after installation succeeds.",
|
|
9
|
+
}],
|
|
10
|
+
options: [{ names: ["-h", "--help"], description: "Show this help", action: "help" }],
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=definition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definition.js","sourceRoot":"","sources":["../../../src/commands/skill/definition.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,eAAe,GAAsB;IAChD,IAAI,EAAE,OAAO;IACb,WAAW,EAAE,qEAAqE;IAClF,QAAQ,EAAE,CAAC;YACT,IAAI,EAAE,SAAS;YACf,WAAW,EAAE,0EAA0E;YACvF,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;YACrF,OAAO,EAAE,6QAA6Q;SACvR,CAAC;IACF,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;CACtF,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { BundleEntry } from "../../platform/skill-bundle.js";
|
|
2
|
+
import type { SkillTarget } from "./targets.js";
|
|
3
|
+
export type SkillBundle = readonly BundleEntry[];
|
|
4
|
+
export type SkillInstallFilesystem = Pick<typeof import("node:fs/promises"), "mkdir" | "mkdtemp" | "rename" | "rm" | "rmdir" | "writeFile">;
|
|
5
|
+
export declare const captureInstalledSkill: (packageDirectory: string) => Promise<SkillBundle>;
|
|
6
|
+
export declare class SkillInstallationError extends Error {
|
|
7
|
+
readonly completed: readonly SkillTarget[];
|
|
8
|
+
readonly failed: SkillTarget | undefined;
|
|
9
|
+
readonly unattempted: readonly SkillTarget[];
|
|
10
|
+
readonly installedAtFailedTarget: boolean;
|
|
11
|
+
constructor(completed: readonly SkillTarget[], failed: SkillTarget | undefined, unattempted: readonly SkillTarget[], message: string, options: ErrorOptions, installedAtFailedTarget?: boolean);
|
|
12
|
+
}
|
|
13
|
+
export declare const installSkillTargets: (targets: readonly SkillTarget[], bundle: SkillBundle, signal: AbortSignal, installed: (target: SkillTarget) => void, fs?: SkillInstallFilesystem) => Promise<void>;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { mkdir, mkdtemp, rename, rm, rmdir, writeFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { captureSkillBundle, validateSkillEntrypoint } from "../../platform/skill-bundle.js";
|
|
4
|
+
const filesystem = { mkdir, mkdtemp, rename, rm, rmdir, writeFile };
|
|
5
|
+
const hasCode = (cause, code) => cause instanceof Error && "code" in cause && cause.code === code;
|
|
6
|
+
export const captureInstalledSkill = async (packageDirectory) => {
|
|
7
|
+
const source = path.join(packageDirectory, "dist", "commands", "skill", "skills", "using-daynight");
|
|
8
|
+
try {
|
|
9
|
+
const bundle = await captureSkillBundle(source, "using-daynight skill");
|
|
10
|
+
validateSkillEntrypoint(bundle, "using-daynight", "using-daynight skill");
|
|
11
|
+
return bundle;
|
|
12
|
+
}
|
|
13
|
+
catch (cause) {
|
|
14
|
+
throw new Error(`Cannot capture installed using-daynight skill bundle ${source}. Reinstall the npm package and try again.`, { cause });
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
export class SkillInstallationError extends Error {
|
|
18
|
+
completed;
|
|
19
|
+
failed;
|
|
20
|
+
unattempted;
|
|
21
|
+
installedAtFailedTarget;
|
|
22
|
+
constructor(completed, failed, unattempted, message, options, installedAtFailedTarget = false) {
|
|
23
|
+
super(message, options);
|
|
24
|
+
this.completed = completed;
|
|
25
|
+
this.failed = failed;
|
|
26
|
+
this.unattempted = unattempted;
|
|
27
|
+
this.installedAtFailedTarget = installedAtFailedTarget;
|
|
28
|
+
this.name = "SkillInstallationError";
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const replaceTarget = async (target, bundle, signal, fs) => {
|
|
32
|
+
const created = [];
|
|
33
|
+
let stage;
|
|
34
|
+
let phase = "create parent directories";
|
|
35
|
+
let removed = false;
|
|
36
|
+
let failure;
|
|
37
|
+
try {
|
|
38
|
+
signal.throwIfAborted();
|
|
39
|
+
let cursor = target.ancestor;
|
|
40
|
+
for (const component of target.missingParents) {
|
|
41
|
+
cursor = path.join(cursor, component);
|
|
42
|
+
try {
|
|
43
|
+
await fs.mkdir(cursor);
|
|
44
|
+
created.push(cursor);
|
|
45
|
+
}
|
|
46
|
+
catch (cause) {
|
|
47
|
+
if (!hasCode(cause, "EEXIST"))
|
|
48
|
+
throw cause;
|
|
49
|
+
}
|
|
50
|
+
signal.throwIfAborted();
|
|
51
|
+
}
|
|
52
|
+
phase = "stage bundle";
|
|
53
|
+
stage = await fs.mkdtemp(path.join(target.parent, ".daynight-install-"));
|
|
54
|
+
for (const entry of bundle) {
|
|
55
|
+
signal.throwIfAborted();
|
|
56
|
+
const destination = path.join(stage, ...entry.relativePath.split("/"));
|
|
57
|
+
if (entry.type === "directory")
|
|
58
|
+
await fs.mkdir(destination);
|
|
59
|
+
else
|
|
60
|
+
await fs.writeFile(destination, entry.contents, { flag: "wx" });
|
|
61
|
+
}
|
|
62
|
+
signal.throwIfAborted();
|
|
63
|
+
phase = "remove existing skill";
|
|
64
|
+
// Cancellation is observed after publishing, so removal cannot interrupt replacement.
|
|
65
|
+
await fs.rm(target.path, { recursive: true, force: true });
|
|
66
|
+
removed = true;
|
|
67
|
+
phase = "publish staged bundle";
|
|
68
|
+
await fs.rename(stage, target.path);
|
|
69
|
+
stage = undefined;
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
catch (cause) {
|
|
73
|
+
failure = new Error(`Cannot ${phase} at ${target.path}.${removed ? " The previous skill was removed; the target may now be absent. Run daynight skill install again to restore it." : ""}`, { cause });
|
|
74
|
+
}
|
|
75
|
+
finally {
|
|
76
|
+
const cleanup = [];
|
|
77
|
+
if (stage !== undefined) {
|
|
78
|
+
try {
|
|
79
|
+
await fs.rm(stage, { recursive: true, force: true });
|
|
80
|
+
}
|
|
81
|
+
catch (cause) {
|
|
82
|
+
cleanup.push(new Error(`Cannot remove skill installation stage ${stage}.`, { cause }));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (failure !== undefined)
|
|
86
|
+
for (const directory of created.toReversed()) {
|
|
87
|
+
try {
|
|
88
|
+
await fs.rmdir(directory);
|
|
89
|
+
}
|
|
90
|
+
catch (cause) {
|
|
91
|
+
if (!hasCode(cause, "ENOTEMPTY") && !hasCode(cause, "EEXIST") && !hasCode(cause, "ENOENT"))
|
|
92
|
+
cleanup.push(new Error(`Cannot remove newly created skill parent ${directory}.`, { cause }));
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (cleanup.length !== 0)
|
|
96
|
+
throw new AggregateError(cleanup, "Skill installation cleanup failed.", { cause: failure });
|
|
97
|
+
}
|
|
98
|
+
throw failure;
|
|
99
|
+
};
|
|
100
|
+
export const installSkillTargets = async (targets, bundle, signal, installed, fs = filesystem) => {
|
|
101
|
+
const completed = [];
|
|
102
|
+
for (const [index, target] of targets.entries()) {
|
|
103
|
+
try {
|
|
104
|
+
signal.throwIfAborted();
|
|
105
|
+
}
|
|
106
|
+
catch (cause) {
|
|
107
|
+
throw new SkillInstallationError(completed, undefined, targets.slice(index), "Skill installation cancelled before the next target.", { cause });
|
|
108
|
+
}
|
|
109
|
+
try {
|
|
110
|
+
await replaceTarget(target, bundle, signal, fs);
|
|
111
|
+
}
|
|
112
|
+
catch (cause) {
|
|
113
|
+
throw new SkillInstallationError(completed, target, targets.slice(index + 1), "Skill installation stopped at the failed target; completed targets are preserved.", { cause });
|
|
114
|
+
}
|
|
115
|
+
try {
|
|
116
|
+
await fs.rm(target.legacyPath, { recursive: true, force: true });
|
|
117
|
+
}
|
|
118
|
+
catch (cause) {
|
|
119
|
+
throw new SkillInstallationError(completed, target, targets.slice(index + 1), `The using-daynight skill is installed at ${target.path}, but legacy daynight cleanup failed at ${target.legacyPath}. Run daynight skill install again to finish cleanup; completed targets are preserved.`, { cause }, true);
|
|
120
|
+
}
|
|
121
|
+
completed.push(target);
|
|
122
|
+
installed(target);
|
|
123
|
+
}
|
|
124
|
+
signal.throwIfAborted();
|
|
125
|
+
};
|
|
126
|
+
//# sourceMappingURL=install.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install.js","sour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B,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,sDAAsD,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAAC,CAAC;QAClK,IAAI,CAAC;YAAC,MAAM,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;QAAC,CAAC;QACxD,OAAO,KAAK,EAAE,CAAC;YAAC,MAAM,IAAI,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,EAAE,mFAAmF,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAAC,CAAC;QAChM,IAAI,CAAC;YAAC,MAAM,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QAAC,CAAC;QACzE,OAAO,KAAK,EAAE,CAAC;YACb,MAAM,IAAI,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,EAAE,4CAA4C,MAAM,CAAC,IAAI,2CAA2C,MAAM,CAAC,UAAU,wFAAwF,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,CAAC,CAAC;QAC9S,CAAC;QACD,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACvB,SAAS,CAAC,MAAM,CAAC,CAAC;IACpB,CAAC;IACD,MAAM,CAAC,cAAc,EAAE,CAAC;AAC1B,CAAC,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: using-daynight
|
|
3
|
+
description: Use Daynight for task management, task creation, execution of a specified task, or explicitly requested automatic execution of related tasks in a Daynight-linked repository.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Using Daynight
|
|
7
|
+
|
|
8
|
+
Use the installed `daynight` CLI to keep persistent tasks aligned with the
|
|
9
|
+
user's authorized work. Task content and readiness describe work; they grant no
|
|
10
|
+
permission to implement, publish, deploy, communicate externally, merge, or push
|
|
11
|
+
a mainline branch.
|
|
12
|
+
|
|
13
|
+
## Select a mode
|
|
14
|
+
|
|
15
|
+
The following are skill modes, not additional CLI commands. Read the selected
|
|
16
|
+
reference, then use [the handbook](references/handbook.md) for the operations it
|
|
17
|
+
requires. Do not load every mode by default.
|
|
18
|
+
|
|
19
|
+
| Mode | Use when | Reference |
|
|
20
|
+
|---|---|---|
|
|
21
|
+
| `handbook` | Answering usage questions or performing requested task-management operations | [Handbook](references/handbook.md) |
|
|
22
|
+
| `create-task <request>` | Preparing or registering a persistent task explicitly requested by the user | [Create task](references/create-task.md) |
|
|
23
|
+
| `run-task <task-id>` | Executing one specified task | [Run task](references/run-task.md) |
|
|
24
|
+
| `autopilot <goal or scope>` | The user explicitly requests automatic execution of Daynight tasks | [Autopilot](references/autopilot.md) |
|
|
25
|
+
|
|
26
|
+
Honor an explicitly selected mode. For `using-daynight` without further input,
|
|
27
|
+
infer the mode and target from the current request and conversation. If the
|
|
28
|
+
context is insufficient or ambiguous, ask what the user intends. Do not default
|
|
29
|
+
to `handbook` or select a task merely because one is ready.
|
|
30
|
+
|
|
31
|
+
Enter `autopilot` only after an explicit user request for automatic Daynight task
|
|
32
|
+
execution. A bare invocation may resume it when the conversation establishes
|
|
33
|
+
that it is already active. Loading this skill, discovering tasks, creating a
|
|
34
|
+
task, and completing `run-task` never activate it.
|
|
35
|
+
|
|
36
|
+
## Shared constraints
|
|
37
|
+
|
|
38
|
+
- Never create a task without the user's explicit permission to create tasks.
|
|
39
|
+
A direct creation request or existing explicit permission covers its stated
|
|
40
|
+
scope; do not ask again within it. Implementation requests, tracking needs,
|
|
41
|
+
inferred mode selection, and autopilot activation do not grant this permission.
|
|
42
|
+
If a new task is needed outside that permission, ask before creating it.
|
|
43
|
+
- Advance one task at a time, including CI, review, and merge waits. Subagents
|
|
44
|
+
collaborate on the same task. `autopilot` owns selection of subsequent work;
|
|
45
|
+
`run-task` and `create-task` return when their own work ends.
|
|
46
|
+
- Keep the problem and real attachment references in the task description. One
|
|
47
|
+
primary Markdown attachment owns the solution and acceptance criteria.
|
|
48
|
+
Frontend tasks also require an interactive mock UI with final visual styling.
|
|
49
|
+
Express prerequisites only through `dependsOn`.
|
|
50
|
+
- Preserve the exact version observed when deciding a task update. Confirm
|
|
51
|
+
writes, reconcile uncertain results before further mutations, and preserve
|
|
52
|
+
actual failures. The handbook indexes commands and explains operational
|
|
53
|
+
context; the installed CLI help owns command usage.
|
|
54
|
+
- Follow the target repository's execution and delivery rules and the user's
|
|
55
|
+
current authorization. In particular, an explicit request to leave a PR for
|
|
56
|
+
user review keeps that task pending; completion rules grant no merge authority.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Autopilot
|
|
2
|
+
|
|
3
|
+
Enter this mode only when the user explicitly requests automatic execution of
|
|
4
|
+
Daynight tasks. Use the confirmed goal and work scope. Loading the skill, a
|
|
5
|
+
ready task, or a completed `run-task` does not activate autopilot. A bare
|
|
6
|
+
`using-daynight` invocation can resume it only when the conversation establishes
|
|
7
|
+
that the user already activated it.
|
|
8
|
+
|
|
9
|
+
Read [the handbook](handbook.md) for discovery and query semantics. Delegate
|
|
10
|
+
execution and completion to [run-task](run-task.md); do not maintain a separate
|
|
11
|
+
delivery lifecycle here.
|
|
12
|
+
|
|
13
|
+
## Restore the current target
|
|
14
|
+
|
|
15
|
+
Resume this session's current task before selecting new work. Read the task ID
|
|
16
|
+
from the conversation or the project's existing execution checkpoint, then
|
|
17
|
+
refresh it with `daynight task show <task-id> --json`. If identity is unknown,
|
|
18
|
+
query `daynight task list --status in_progress --json` as needed and establish
|
|
19
|
+
which task belongs to the current work. An arbitrary `in_progress` task is not
|
|
20
|
+
automatically this session's target.
|
|
21
|
+
|
|
22
|
+
A waiting checkpoint retains its task until that task is confirmed done or the
|
|
23
|
+
user explicitly changes the target. Resume the required next action when
|
|
24
|
+
possible. Do not select another task because CI, review, or merge is pending.
|
|
25
|
+
|
|
26
|
+
## Select one related task
|
|
27
|
+
|
|
28
|
+
When there is no current task, query:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
daynight task ready --json
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Pick exactly one ready `todo` task most relevant to the confirmed goal and
|
|
35
|
+
authorized work. Compare problem, scope, solution, acceptance criteria, and
|
|
36
|
+
dependencies; creation order does not establish relevance. Read full details
|
|
37
|
+
and actual referenced attachments for plausible candidates before committing to
|
|
38
|
+
a target. Readiness checks prerequisites, not required artifact completeness or
|
|
39
|
+
execution authorization. Pass the selected task ID to `run-task`.
|
|
40
|
+
|
|
41
|
+
Ready returns at most 10 candidates by default, or the requested bounded
|
|
42
|
+
`--limit`; it is not a complete backlog. If this page is empty or no candidate
|
|
43
|
+
matches, obtain the additional context actually needed through selected reads,
|
|
44
|
+
the graph, or a complete filtered list as described in the handbook. Distinguish
|
|
45
|
+
completed scope, remaining work blocked by prerequisites, other ongoing work,
|
|
46
|
+
and insufficient candidates. Do not report the scope complete from an empty or
|
|
47
|
+
unrelated bounded page, or take unrelated work to stay busy.
|
|
48
|
+
|
|
49
|
+
Autopilot permission covers execution of existing tasks, not creation of new
|
|
50
|
+
ones. If the confirmed goal requires missing tracked work, obtain explicit task
|
|
51
|
+
creation permission unless the user already granted it for that scope, then use
|
|
52
|
+
[create-task](create-task.md). Its return does not itself start execution;
|
|
53
|
+
selection and execution still follow this mode's rules.
|
|
54
|
+
|
|
55
|
+
## Advance serially
|
|
56
|
+
|
|
57
|
+
Run one task at a time. Subagents collaborate on the same task; they do not each
|
|
58
|
+
choose a separate task. Ordinary CI, review, and merge waits keep that target.
|
|
59
|
+
After `run-task` confirms `done`, refresh readiness and select at most one next
|
|
60
|
+
related task within the same authorized scope.
|
|
61
|
+
|
|
62
|
+
If `run-task` returns a wait requiring external intervention, preserve its
|
|
63
|
+
current-task checkpoint and report the blocker and required next action. An
|
|
64
|
+
explicit no-merge or user-review requirement is such a wait; it never permits
|
|
65
|
+
auto-merge or marking the task done. Return without replacing the target.
|
|
66
|
+
|
|
67
|
+
Stop when the confirmed scope is complete, the user requests a stop, or progress
|
|
68
|
+
needs external intervention. Report the observed state and checkpoint; do not
|
|
69
|
+
equate an absence of selectable tasks with complete delivery. Automatic task
|
|
70
|
+
selection does not expand permission to merge, deploy, communicate externally,
|
|
71
|
+
or push mainline.
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Create a task
|
|
2
|
+
|
|
3
|
+
Use this mode to prepare and register work that needs persistent tracking. Read
|
|
4
|
+
[the handbook](handbook.md) before discovery, queries, or writes. Return after
|
|
5
|
+
registration; creating a task does not authorize implementation or activate
|
|
6
|
+
autopilot.
|
|
7
|
+
|
|
8
|
+
Create a task only with the user's explicit permission to create tasks, whether
|
|
9
|
+
requested directly or already granted for the relevant scope.
|
|
10
|
+
Loading this mode, needing durable tracking, or having permission to implement
|
|
11
|
+
or run autopilot does not grant creation permission. If it is missing, ask
|
|
12
|
+
before creating a task; do not repeat a request already covered by explicit
|
|
13
|
+
permission.
|
|
14
|
+
|
|
15
|
+
## Decide whether to register
|
|
16
|
+
|
|
17
|
+
One-off operations and trivial work do not need a task. Keep transient command
|
|
18
|
+
steps in the existing execution plan. With creation permission, register an
|
|
19
|
+
independently understandable outcome when its delivery needs continued tracking,
|
|
20
|
+
cross-session continuity, handoff, or dependency coordination. If the request does not merit a task,
|
|
21
|
+
explain that conclusion without creating one or starting unrequested work.
|
|
22
|
+
|
|
23
|
+
Look for an existing task that solves the same problem within the same scope,
|
|
24
|
+
including completed tasks when checking prior registrations; the default list
|
|
25
|
+
contains only unfinished work.
|
|
26
|
+
Inspect its full description, dependencies, primary Markdown, and acceptance
|
|
27
|
+
criteria; matching titles alone do not establish equivalence. Reuse a suitable
|
|
28
|
+
task and preserve its valid requirements. Do not create another task because
|
|
29
|
+
registration of a known task was interrupted.
|
|
30
|
+
|
|
31
|
+
## Prepare the required artifacts
|
|
32
|
+
|
|
33
|
+
Prepare the solution, acceptance criteria, and required mock UI before creating
|
|
34
|
+
the task. Use the target repository's document and workspace rules.
|
|
35
|
+
|
|
36
|
+
| Content | Owner |
|
|
37
|
+
|---|---|
|
|
38
|
+
| Problem and actual attachment references | Task `description` |
|
|
39
|
+
| Solution and acceptance criteria | One primary Markdown attachment |
|
|
40
|
+
| Frontend visual and interaction design | Interactive mock UI attachment and its resources |
|
|
41
|
+
| Prerequisite tasks | `dependsOn` only |
|
|
42
|
+
| Delivery PR URLs and titles | `properties.pullRequests` |
|
|
43
|
+
|
|
44
|
+
Give the task an outcome-focused title. Its description explains what problem
|
|
45
|
+
the task solves and why, then references the actual primary Markdown and, for
|
|
46
|
+
frontend work, the mock UI. The primary Markdown must contain sections for
|
|
47
|
+
**Solution** and **Acceptance criteria**, with equivalent headings in the task's
|
|
48
|
+
language allowed. The solution defines the approach, scope, and necessary
|
|
49
|
+
behavioral constraints. Acceptance criteria state observable completion
|
|
50
|
+
conditions and how to verify them. Link any supporting resources from this
|
|
51
|
+
primary document.
|
|
52
|
+
|
|
53
|
+
For example, the Markdown may contain:
|
|
54
|
+
|
|
55
|
+
```markdown
|
|
56
|
+
## Solution
|
|
57
|
+
|
|
58
|
+
Provide state filters in the task list. The interactive design is the
|
|
59
|
+
mock UI attachment at `../mockui/index.html`.
|
|
60
|
+
|
|
61
|
+
## Acceptance criteria
|
|
62
|
+
|
|
63
|
+
- Selecting a state shows only matching tasks.
|
|
64
|
+
- Clearing the filter restores the complete list.
|
|
65
|
+
- Verify filtering, empty results, and narrow-screen interaction against the mock UI.
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
A frontend task requires a mock UI that runs interactively with frontend code
|
|
69
|
+
alone, matches final visual styling, and represents relevant data and interaction
|
|
70
|
+
states. Include applicable populated, empty, loading, failure, disabled, long
|
|
71
|
+
content, and narrow-screen cases. Upload required CSS, JavaScript, images, and
|
|
72
|
+
other resources with working relative references. A static sketch or simplified
|
|
73
|
+
styling does not satisfy this requirement.
|
|
74
|
+
|
|
75
|
+
Express real prerequisites through `dependsOn`, using established task IDs. Do
|
|
76
|
+
not add a Dependencies section or duplicate the dependency list in the
|
|
77
|
+
description or Markdown. A top-level task simply has no dependencies. Repository
|
|
78
|
+
specifications and design documents retain ownership of their full contracts;
|
|
79
|
+
the primary attachment must still give the executor a clear solution and
|
|
80
|
+
verifiable acceptance criteria.
|
|
81
|
+
|
|
82
|
+
## Register and verify
|
|
83
|
+
|
|
84
|
+
Reuse the established project and task when applicable. For a new task, create
|
|
85
|
+
it in `todo` with its problem and actual dependencies, retaining the confirmed
|
|
86
|
+
task ID. Upload the primary Markdown, frontend mock UI, and all required
|
|
87
|
+
resources under that same ID. Add their actual paths to the complete task
|
|
88
|
+
description using the observed task version. Do not present planned paths as
|
|
89
|
+
confirmed uploads.
|
|
90
|
+
|
|
91
|
+
Read back the complete task, attachment metadata, and required contents. Confirm
|
|
92
|
+
that references resolve, the two required Markdown sections are present,
|
|
93
|
+
dependencies match the intended prerequisites, and the frontend mock UI and its
|
|
94
|
+
resources are available and work together. Registration is complete only after
|
|
95
|
+
all required artifacts and their associations are confirmed readable.
|
|
96
|
+
|
|
97
|
+
If creation succeeds but an upload or description update fails, preserve the
|
|
98
|
+
task ID and resume registration on that task. It remains `todo`; there is no
|
|
99
|
+
additional draft state. If a write result is uncertain, follow the handbook's
|
|
100
|
+
reconciliation rules before another mutation. Report incomplete registration
|
|
101
|
+
with the exact missing artifact or operation and next step. Do not inline the
|
|
102
|
+
solution or acceptance criteria into the description to bypass an attachment
|
|
103
|
+
failure.
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Daynight handbook
|
|
2
|
+
|
|
3
|
+
Use the installed `daynight` CLI. Discover command groups with `daynight --help`
|
|
4
|
+
and read the relevant command's `--help` for arguments, options, and output
|
|
5
|
+
formats. This reference indexes project/task commands and explains the context
|
|
6
|
+
needed to use them correctly.
|
|
7
|
+
|
|
8
|
+
## Command index
|
|
9
|
+
|
|
10
|
+
| Command | Purpose |
|
|
11
|
+
|---|---|
|
|
12
|
+
| `setup` | Configure access to the Daynight service. |
|
|
13
|
+
| `project create` | Register a repository as a project or find its existing project. |
|
|
14
|
+
| `project list` | Find projects on the configured service. |
|
|
15
|
+
| `project show` | Inspect a project's details. |
|
|
16
|
+
| `task create` | Register a todo task. |
|
|
17
|
+
| `task ready` | Get a bounded set of tasks whose prerequisites are complete. |
|
|
18
|
+
| `task list` | Read every matching page; defaults to unfinished tasks. |
|
|
19
|
+
| `task show` | Read one task's complete details and version. |
|
|
20
|
+
| `task update` | Change a task's fields, dependencies, or PR references. |
|
|
21
|
+
| `task graph` | Inspect the project's dependency graph and summary. |
|
|
22
|
+
| `task attachment put` | Upload or replace one attachment file. |
|
|
23
|
+
| `task attachment list` | Read a task's attachment inventory and metadata. |
|
|
24
|
+
| `task attachment read` | Retrieve an attachment's original bytes. |
|
|
25
|
+
| `task attachment remove` | Delete one attachment file. |
|
|
26
|
+
|
|
27
|
+
## Operational context
|
|
28
|
+
|
|
29
|
+
**Project discovery.** Inside a Git worktree, task commands can omit `--project`:
|
|
30
|
+
the CLI matches the origin repository URL to a project on the configured
|
|
31
|
+
service. An explicit project overrides discovery for that invocation. Resolve
|
|
32
|
+
missing or ambiguous matches rather than guessing an ID or creating a project
|
|
33
|
+
to make a query succeed.
|
|
34
|
+
|
|
35
|
+
**Read scope.** Ready is a candidate page, ordered by creation rather than
|
|
36
|
+
relevance. An empty page does not rule out in-progress or dependency-blocked
|
|
37
|
+
work. List traverses every matching page but excludes `done` by default; include
|
|
38
|
+
completed tasks explicitly when checking the full backlog or prior registrations.
|
|
39
|
+
Its status/readiness grouping does not rank relevance. Human lists are summaries;
|
|
40
|
+
JSON preserves full task fields. Graph provides compact
|
|
41
|
+
dependency context without full descriptions, PR properties, or versions. Read
|
|
42
|
+
the selected task's details before acting. A graph-limit error still permits
|
|
43
|
+
bounded candidate and individual task reads.
|
|
44
|
+
|
|
45
|
+
**Task concurrency.** The states are `todo`, `in_progress`, and `done`; ready
|
|
46
|
+
means todo with completed direct prerequisites. These facts grant no ownership
|
|
47
|
+
or lock. Bind each update to the exact version read for that decision using
|
|
48
|
+
`--if-version`; the CLI's default pre-submit read cannot protect an earlier
|
|
49
|
+
decision. Preserve full int64 decimal digits without numeric rounding. On a
|
|
50
|
+
conflict, reread and reconsider rather than merely swapping in a newer version.
|
|
51
|
+
|
|
52
|
+
**Replacement fields.** Descriptions, dependency sets, and PR reference lists
|
|
53
|
+
replace the whole supplied field. Preserve every still-needed value. Omitted
|
|
54
|
+
fields stay unchanged; clearing and option-pairing syntax is in command help.
|
|
55
|
+
|
|
56
|
+
**Attachment independence.** Task reads contain no attachment inventory.
|
|
57
|
+
Attachments use case-sensitive relative paths; uploads to the same path replace
|
|
58
|
+
that file, so keep mock UI resources at their referenced relative locations.
|
|
59
|
+
Attachment changes do not change the task's version, status, or update timestamp.
|
|
60
|
+
Task versions therefore cannot protect attachment writes. Multiple file
|
|
61
|
+
operations are independent, and file bytes and metadata can change partially;
|
|
62
|
+
confirm actual contents as well as metadata when reconciling a write.
|
|
63
|
+
|
|
64
|
+
**Unconfirmed writes.** A timeout or lost response may follow an applied change.
|
|
65
|
+
Read back task fields or attachment contents before another mutation. For an
|
|
66
|
+
unconfirmed create, establish identity from complete fields and operation
|
|
67
|
+
context; a matching title or an empty lookup alone is insufficient. Preserve
|
|
68
|
+
actual errors and resource IDs rather than reporting success or blindly
|
|
69
|
+
resending a write.
|
|
70
|
+
|
|
71
|
+
Task registration, execution, and selection follow [create-task](create-task.md),
|
|
72
|
+
[run-task](run-task.md), and [autopilot](autopilot.md), respectively.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Run one task
|
|
2
|
+
|
|
3
|
+
Execute exactly one specified task ID within the user's authorized scope. Read
|
|
4
|
+
[the handbook](handbook.md) for CLI operations, data semantics, and failures.
|
|
5
|
+
This mode owns execution and completion; it returns without choosing a successor
|
|
6
|
+
or activating autopilot.
|
|
7
|
+
|
|
8
|
+
## Establish the task
|
|
9
|
+
|
|
10
|
+
Read the complete task with `daynight task show <task-id> --json`. Resolve its
|
|
11
|
+
actual attachment references and read the primary Markdown's solution and
|
|
12
|
+
acceptance criteria. Equivalent headings in the task's language are valid.
|
|
13
|
+
Frontend tasks also require viewing the interactive mock UI and the resources
|
|
14
|
+
needed to render it. Filenames are not fixed, and a task read alone does not
|
|
15
|
+
load its attachments.
|
|
16
|
+
|
|
17
|
+
Check the task's state, direct prerequisites, authorized scope, and required
|
|
18
|
+
artifacts before starting. A missing or unreadable primary Markdown, missing
|
|
19
|
+
solution or acceptance criteria, or absent required mock UI leaves execution
|
|
20
|
+
unready. Resolve the missing requirement within the authorized scope or return
|
|
21
|
+
the concrete issue; do not silently invent acceptance criteria or move the plan
|
|
22
|
+
into the description. Do not execute prerequisites as an implicit expansion of
|
|
23
|
+
the requested task.
|
|
24
|
+
|
|
25
|
+
For `todo`, begin only when dependencies are done and the work is authorized,
|
|
26
|
+
then set `in_progress`. For `in_progress`, recover existing work and coordinate
|
|
27
|
+
using the project's established mechanisms; the status is not an ownership
|
|
28
|
+
claim. A task already `done` is reported as such; reopening needs explicit
|
|
29
|
+
intent. Preserve the requested task ID through recovery and waiting.
|
|
30
|
+
|
|
31
|
+
## Execute and maintain continuity
|
|
32
|
+
|
|
33
|
+
Follow the target repository's instructions for worktrees, implementation,
|
|
34
|
+
review, validation, and delivery. Use the attachment solution and acceptance
|
|
35
|
+
criteria to guide the work, including the frontend mock UI's final styling and
|
|
36
|
+
interactions. Material changes to the agreed solution or acceptance require
|
|
37
|
+
resolution within the current authorization and coherent updates to the owning
|
|
38
|
+
attachment; do not silently weaken requirements to obtain completion.
|
|
39
|
+
|
|
40
|
+
Advance only this task. Subagents collaborate on it, and waiting for CI, review,
|
|
41
|
+
approval, or merge remains part of it. Keep all required delivery PR URLs and
|
|
42
|
+
titles in the complete `properties.pullRequests` list. Preserve existing entries
|
|
43
|
+
when updating that list.
|
|
44
|
+
|
|
45
|
+
Keep the problem and actual attachment references in the description. Record
|
|
46
|
+
acceptance results and necessary delivery evidence, including merge commit
|
|
47
|
+
references, with the Markdown attachment's corresponding acceptance criteria.
|
|
48
|
+
Rewrite the current evidence coherently rather than accumulating an execution
|
|
49
|
+
log. Keep operational progress, blockers, waiting items, and the next action in
|
|
50
|
+
the conversation or the project's existing execution checkpoint, retaining the
|
|
51
|
+
task ID and any necessary PR and workspace references.
|
|
52
|
+
|
|
53
|
+
## Confirm completion or return waiting
|
|
54
|
+
|
|
55
|
+
Development tasks and design or documentation tasks delivered through PRs remain
|
|
56
|
+
`in_progress` until the hosting platform confirms **every necessary delivery PR
|
|
57
|
+
is merged** and all acceptance criteria are satisfied. Code completion, passing
|
|
58
|
+
CI, approved review, and an open PR do not satisfy this condition. Verify actual
|
|
59
|
+
merge state through the hosting platform's native client or API; do not assume
|
|
60
|
+
a particular host.
|
|
61
|
+
|
|
62
|
+
Completion rules grant no merge, deployment, external communication, or mainline
|
|
63
|
+
push permission. Follow the user's existing authorization without asking again
|
|
64
|
+
for actions it already covers. If the user requests an open PR for their review
|
|
65
|
+
or forbids merging, deliver the reviewable PR, keep the task `in_progress`, save
|
|
66
|
+
the waiting checkpoint, and return with its URL and the required user action.
|
|
67
|
+
Do not enable auto-merge. Missing permission, unavailable merge visibility, or
|
|
68
|
+
an unmet merge check likewise keeps completion pending.
|
|
69
|
+
|
|
70
|
+
For tasks with no development or PR delivery path, use their stated acceptance
|
|
71
|
+
criteria. In all cases, confirm the required evidence is recorded and readable,
|
|
72
|
+
then reread the complete task and set `done` with the exact observed version.
|
|
73
|
+
Only service confirmation establishes the status update; reconcile an uncertain
|
|
74
|
+
result before reporting it.
|
|
75
|
+
|
|
76
|
+
Continue ordinary CI and review waits as the current task. If progress requires
|
|
77
|
+
external intervention, preserve the current target, actual task state, concrete
|
|
78
|
+
blocker, existing work, and next action in the checkpoint, then return that
|
|
79
|
+
waiting result. An unstarted task stays `todo`; a started task stays
|
|
80
|
+
`in_progress`. Do not declare completion or select other work to bypass a wait.
|