@codetreker/daynight 0.26.0 → 0.29.0
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/README.md +128 -17
- package/dist/api/client.d.ts +7 -2
- package/dist/api/client.js +46 -18
- package/dist/api/client.js.map +1 -1
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/index.js.map +1 -1
- package/dist/api/json.js +27 -6
- package/dist/api/json.js.map +1 -1
- package/dist/api/parse.d.ts +4 -6
- package/dist/api/parse.js +51 -93
- package/dist/api/parse.js.map +1 -1
- package/dist/api/resource-path.d.ts +1 -0
- package/dist/api/resource-path.js +8 -0
- package/dist/api/resource-path.js.map +1 -0
- package/dist/api/task-properties.d.ts +7 -0
- package/dist/api/task-properties.js +81 -0
- package/dist/api/task-properties.js.map +1 -0
- package/dist/api/types.d.ts +95 -6
- package/dist/api/validation.d.ts +15 -0
- package/dist/api/validation.js +43 -0
- package/dist/api/validation.js.map +1 -0
- package/dist/cli/schema.d.ts +3 -0
- package/dist/cli/schema.js +14 -4
- package/dist/cli/schema.js.map +1 -1
- package/dist/commands/completion/bash.d.ts +1 -1
- package/dist/commands/completion/bash.js +6 -3
- package/dist/commands/completion/bash.js.map +1 -1
- package/dist/commands/completion/zsh.d.ts +1 -1
- package/dist/commands/completion/zsh.js +7 -7
- package/dist/commands/completion/zsh.js.map +1 -1
- package/dist/commands/skill/skills/using-daynight/SKILL.md +52 -162
- package/dist/commands/skill/skills/using-daynight/references/authorization.md +36 -0
- package/dist/commands/skill/skills/using-daynight/references/autopilot-managed-task.md +77 -193
- package/dist/commands/skill/skills/using-daynight/references/create-task.md +31 -186
- package/dist/commands/skill/skills/using-daynight/references/final-acceptance.md +25 -0
- package/dist/commands/skill/skills/using-daynight/references/goal.md +46 -243
- package/dist/commands/skill/skills/using-daynight/references/handbook.md +38 -294
- package/dist/commands/skill/skills/using-daynight/references/handoff.md +33 -91
- package/dist/commands/skill/skills/using-daynight/references/project-management.md +24 -0
- package/dist/commands/skill/skills/using-daynight/references/run-task.md +18 -59
- package/dist/commands/skill/skills/using-daynight/references/setup.md +16 -0
- package/dist/commands/skill/skills/using-daynight/references/task-content.md +80 -177
- package/dist/commands/skill/skills/using-daynight/references/task-execution.md +34 -126
- package/dist/commands/skill/skills/using-daynight/references/task-management.md +162 -0
- package/dist/commands/skill/skills/using-daynight/references/write-safety.md +34 -0
- package/dist/commands/task/command.js +12 -14
- package/dist/commands/task/command.js.map +1 -1
- package/dist/commands/task/definition.js +32 -13
- package/dist/commands/task/definition.js.map +1 -1
- package/dist/commands/task/property.d.ts +6 -0
- package/dist/commands/task/property.js +51 -0
- package/dist/commands/task/property.js.map +1 -0
- package/dist/commands/task/rendering.d.ts +4 -1
- package/dist/commands/task/rendering.js +35 -9
- package/dist/commands/task/rendering.js.map +1 -1
- package/dist/commands/worker/control.js +10 -6
- package/dist/commands/worker/control.js.map +1 -1
- package/dist/commands/worker/coordinator.d.ts +3 -1
- package/dist/commands/worker/coordinator.js +28 -17
- package/dist/commands/worker/coordinator.js.map +1 -1
- package/dist/commands/worker/herdr/command.d.ts +11 -2
- package/dist/commands/worker/herdr/command.js +23 -8
- package/dist/commands/worker/herdr/command.js.map +1 -1
- package/dist/commands/worker/herdr/instance.d.ts +5 -1
- package/dist/commands/worker/herdr/instance.js +30 -0
- package/dist/commands/worker/herdr/instance.js.map +1 -1
- package/dist/commands/worker/herdr/preflight.js +4 -6
- package/dist/commands/worker/herdr/preflight.js.map +1 -1
- package/dist/commands/worker/herdr/version-probe.d.ts +13 -0
- package/dist/commands/worker/herdr/version-probe.js +21 -0
- package/dist/commands/worker/herdr/version-probe.js.map +1 -0
- package/dist/commands/worker/herdr.js +2 -6
- package/dist/commands/worker/herdr.js.map +1 -1
- package/dist/commands/worker/index.d.ts +2 -0
- package/dist/commands/worker/index.js +1 -1
- package/dist/commands/worker/index.js.map +1 -1
- package/dist/commands/worker/remote.d.ts +3 -1
- package/dist/commands/worker/remote.js +11 -6
- package/dist/commands/worker/remote.js.map +1 -1
- package/dist/commands/worker/reporter.d.ts +14 -0
- package/dist/commands/worker/reporter.js +174 -0
- package/dist/commands/worker/reporter.js.map +1 -0
- package/dist/commands/worker/runtime.d.ts +2 -0
- package/dist/commands/worker/runtime.js +14 -1
- package/dist/commands/worker/runtime.js.map +1 -1
- package/dist/commands/worker/telemetry.d.ts +22 -0
- package/dist/commands/worker/telemetry.js +265 -0
- package/dist/commands/worker/telemetry.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { isNonemptyText, isText } from "../platform/text.js";
|
|
2
|
+
export class ProtocolError extends Error {
|
|
3
|
+
constructor(message = "The server returned an invalid response.") { super(message); this.name = "ProtocolError"; }
|
|
4
|
+
}
|
|
5
|
+
export const malformed = () => { throw new ProtocolError(); };
|
|
6
|
+
export const record = (value) => {
|
|
7
|
+
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
8
|
+
return malformed();
|
|
9
|
+
return value;
|
|
10
|
+
};
|
|
11
|
+
export const text = (value, nonempty = false) => {
|
|
12
|
+
if (!isText(value) || (nonempty && !isNonemptyText(value)))
|
|
13
|
+
return malformed();
|
|
14
|
+
return value;
|
|
15
|
+
};
|
|
16
|
+
export const bool = (value) => typeof value === "boolean" ? value : malformed();
|
|
17
|
+
export const count = (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0 ? value : malformed();
|
|
18
|
+
export const resourceVersion = (value) => typeof value === "bigint" && value >= 1n && value <= 9223372036854775807n ? value : malformed();
|
|
19
|
+
export const canonicalId = (value) => /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value) ? value.toLowerCase() : null;
|
|
20
|
+
export const id = (value) => {
|
|
21
|
+
const parsed = text(value);
|
|
22
|
+
if (canonicalId(parsed) !== parsed)
|
|
23
|
+
return malformed();
|
|
24
|
+
return parsed;
|
|
25
|
+
};
|
|
26
|
+
export const timestamp = (value) => {
|
|
27
|
+
const parsed = text(value);
|
|
28
|
+
if (!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?Z$/.test(parsed))
|
|
29
|
+
return malformed();
|
|
30
|
+
const milliseconds = Date.parse(parsed);
|
|
31
|
+
if (!Number.isFinite(milliseconds) || new Date(milliseconds).toISOString().slice(0, 19) !== parsed.slice(0, 19))
|
|
32
|
+
return malformed();
|
|
33
|
+
return parsed;
|
|
34
|
+
};
|
|
35
|
+
export const nullableTimestamp = (value) => value === null ? null : timestamp(value);
|
|
36
|
+
export const array = (value, parse) => Array.isArray(value) ? value.map((item) => parse(item)) : malformed();
|
|
37
|
+
export const fields = (value, names) => {
|
|
38
|
+
const data = record(value);
|
|
39
|
+
if (Object.keys(data).some((key) => !names.includes(key)))
|
|
40
|
+
return malformed();
|
|
41
|
+
return data;
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/api/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7D,MAAM,OAAO,aAAc,SAAQ,KAAK;IACtC,YAAY,OAAO,GAAG,0CAA0C,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC,CAAC,CAAC;CACnH;AACD,MAAM,CAAC,MAAM,SAAS,GAAG,GAAU,EAAE,GAAG,MAAM,IAAI,aAAa,EAAE,CAAC,CAAC,CAAC,CAAC;AACrE,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,KAAc,EAA2B,EAAE;IAChE,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,SAAS,EAAE,CA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AG,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QAAE,OAAO,SAAS,EAAE,CAAC;IAC9E,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
package/dist/cli/schema.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ export type CommandArgument = {
|
|
|
15
15
|
name: string;
|
|
16
16
|
description: string;
|
|
17
17
|
choices?: readonly string[];
|
|
18
|
+
optional?: boolean;
|
|
19
|
+
allowEmpty?: boolean;
|
|
18
20
|
};
|
|
19
21
|
export type CommandDefinition = {
|
|
20
22
|
name: string;
|
|
@@ -26,6 +28,7 @@ export type CommandDefinition = {
|
|
|
26
28
|
allowOptionsTerminator?: boolean;
|
|
27
29
|
details?: string;
|
|
28
30
|
};
|
|
31
|
+
export declare const validateCommandArguments: (definition: CommandDefinition) => void;
|
|
29
32
|
type CommandLocation = {
|
|
30
33
|
command: CommandDefinition;
|
|
31
34
|
path: readonly string[];
|
package/dist/cli/schema.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { UsageError } from "./context.js";
|
|
2
|
+
export const validateCommandArguments = (definition) => {
|
|
3
|
+
let optional = false;
|
|
4
|
+
for (const argument of definition.arguments ?? []) {
|
|
5
|
+
if (optional && argument.optional !== true)
|
|
6
|
+
throw new Error(`Command ${definition.name} has a required argument after an optional argument.`);
|
|
7
|
+
optional = argument.optional === true;
|
|
8
|
+
}
|
|
9
|
+
};
|
|
2
10
|
const matchesCommand = (command, name) => command.name === name || command.aliases?.includes(name) === true;
|
|
3
11
|
const informationAction = (command, args) => args.length === 1 ? command.options?.find((option) => option.names.includes(args[0]))?.action : undefined;
|
|
4
12
|
export const selectCommand = (definition, args, path = [definition.name], helpCommand = `${path.join(" ")} --help`) => {
|
|
@@ -13,6 +21,7 @@ export const selectCommand = (definition, args, path = [definition.name], helpCo
|
|
|
13
21
|
return { kind: "selected", command, path: [...path, command.name], remaining: args.slice(1) };
|
|
14
22
|
};
|
|
15
23
|
export const parseCommand = (definition, args, path = [definition.name], helpCommand = `${path.join(" ")} --help`) => {
|
|
24
|
+
validateCommandArguments(definition);
|
|
16
25
|
if (definition.commands !== undefined) {
|
|
17
26
|
const selection = selectCommand(definition, args, path, helpCommand);
|
|
18
27
|
if (selection.kind !== "selected")
|
|
@@ -68,14 +77,14 @@ export const parseCommand = (definition, args, path = [definition.name], helpCom
|
|
|
68
77
|
const positional = definition.arguments?.[values.length];
|
|
69
78
|
if (positional === undefined)
|
|
70
79
|
throw new UsageError(`Unexpected ${path.join(" ")} argument ${JSON.stringify(argument)}.`, helpCommand);
|
|
71
|
-
if (argument === "")
|
|
80
|
+
if (argument === "" && positional.allowEmpty !== true)
|
|
72
81
|
throw new UsageError(`${path.join(" ")} requires a ${positional.name} value.`, helpCommand);
|
|
73
82
|
if (positional.choices !== undefined && !positional.choices.includes(argument)) {
|
|
74
83
|
throw new UsageError(`Unknown ${positional.name} ${JSON.stringify(argument)}. Expected ${positional.choices.join(" or ")}.`, helpCommand);
|
|
75
84
|
}
|
|
76
85
|
values.push(argument);
|
|
77
86
|
}
|
|
78
|
-
const missing = definition.arguments?.
|
|
87
|
+
const missing = definition.arguments?.slice(values.length).find((argument) => argument.optional !== true);
|
|
79
88
|
if (missing !== undefined)
|
|
80
89
|
throw new UsageError(`${path.join(" ")} requires a ${missing.name} value.`, helpCommand);
|
|
81
90
|
for (const option of definition.options ?? []) {
|
|
@@ -92,8 +101,9 @@ const renderRows = (rows) => {
|
|
|
92
101
|
return rows.map(([label, description]) => ` ${label.padEnd(width)}${description}`).join("\n");
|
|
93
102
|
};
|
|
94
103
|
export const renderCommandHelp = (definition, path = [definition.name]) => {
|
|
104
|
+
validateCommandArguments(definition);
|
|
95
105
|
const suffix = definition.commands !== undefined ? " <command>" : [
|
|
96
|
-
...(definition.arguments ?? []).map(({ name }) => ` <${name}>`),
|
|
106
|
+
...(definition.arguments ?? []).map(({ name, optional }) => optional === true ? ` [<${name}>]` : ` <${name}>`),
|
|
97
107
|
...(definition.options ?? []).filter(({ action }) => action === undefined).map((option) => option.required === true ? ` ${optionUsage(option)}` : ` [${optionUsage(option)}]`),
|
|
98
108
|
].join("");
|
|
99
109
|
const paths = [path, ...(definition.aliases ?? []).map((alias) => [...path.slice(0, -1), alias])];
|
|
@@ -103,7 +113,7 @@ export const renderCommandHelp = (definition, path = [definition.name]) => {
|
|
|
103
113
|
if (definition.commands !== undefined)
|
|
104
114
|
sections.push(`Commands:\n${renderRows(definition.commands.map((command) => [[command.name, ...(command.aliases ?? [])].join(", "), command.description]))}`);
|
|
105
115
|
if (definition.arguments !== undefined)
|
|
106
|
-
sections.push(`Arguments:\n${renderRows(definition.arguments.map(({ name, description }) => [`<${name}>`, description]))}`);
|
|
116
|
+
sections.push(`Arguments:\n${renderRows(definition.arguments.map(({ name, description, optional }) => [optional === true ? `[<${name}>]` : `<${name}>`, description]))}`);
|
|
107
117
|
if (definition.options !== undefined)
|
|
108
118
|
sections.push(`Options:\n${renderRows(definition.options.map((option) => [optionLabel(option), option.description]))}`);
|
|
109
119
|
if (definition.details !== undefined)
|
package/dist/cli/schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/cli/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/cli/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AA8B1C,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,UAA6B,EAAQ,EAAE;IAC9E,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,KAAK,MAAM,QAAQ,IAAI,UAAU,CAAC,SAAS,IAAI,EAAE,EAAE,CAAC;QAClD,IAAI,QAAQ,IAAI,QAAQ,CAAC,QAAQ,KAAK,IAAI;YAAE,MAAM,IA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AE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAClN,IAAI,UAAU,CAAC,OAAO,KAAK,SAAS;QAAE,QAAQ,CAAC,IAAI,CAAC,aAAa,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC9J,IAAI,UAAU,CAAC,OAAO,KAAK,SAAS;QAAE,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IACxE,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;AACtC,CAAC,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type CommandDefinition } from "../../cli/schema.js";
|
|
2
2
|
export declare const renderBashCompletion: (root: CommandDefinition) => string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { validateCommandArguments } from "../../cli/schema.js";
|
|
1
2
|
const shellQuote = (value) => `'${value.replaceAll("'", "'\\''")}'`;
|
|
2
3
|
const shellArray = (values) => `(${values.map(shellQuote).join(" ")})`;
|
|
3
4
|
const commandCases = (root) => {
|
|
@@ -5,6 +6,7 @@ const commandCases = (root) => {
|
|
|
5
6
|
const cases = [];
|
|
6
7
|
for (let index = 0; index < nodes.length; index += 1) {
|
|
7
8
|
const node = nodes[index];
|
|
9
|
+
validateCommandArguments(node);
|
|
8
10
|
const childNames = [];
|
|
9
11
|
const childNodes = [];
|
|
10
12
|
for (const child of node.commands ?? []) {
|
|
@@ -44,6 +46,7 @@ const commandCases = (root) => {
|
|
|
44
46
|
dn_option_empty=${shellArray(optionEmpty)}
|
|
45
47
|
dn_option_repeats=${shellArray(optionRepeats)}
|
|
46
48
|
dn_argument_count=${node.arguments?.length ?? 0}
|
|
49
|
+
dn_argument_empty=${shellArray((node.arguments ?? []).map((argument) => argument.allowEmpty === true ? "1" : "0"))}
|
|
47
50
|
dn_allow_terminator=${node.allowOptionsTerminator === true ? 1 : 0}
|
|
48
51
|
case "$dn_position" in
|
|
49
52
|
${choices.join("\n")}
|
|
@@ -110,7 +113,7 @@ const runtime = String.raw `
|
|
|
110
113
|
@PREFIX@_schema() {
|
|
111
114
|
dn_children=(); dn_child_nodes=(); dn_options=(); dn_option_ids=()
|
|
112
115
|
dn_option_values=(); dn_option_actions=(); dn_choices=()
|
|
113
|
-
dn_option_empty=(); dn_option_repeats=(); dn_value_choices=()
|
|
116
|
+
dn_option_empty=(); dn_option_repeats=(); dn_value_choices=(); dn_argument_empty=()
|
|
114
117
|
case "$dn_node" in
|
|
115
118
|
@CASES@
|
|
116
119
|
esac
|
|
@@ -131,7 +134,7 @@ const runtime = String.raw `
|
|
|
131
134
|
local LC_ALL=C
|
|
132
135
|
local -a dn_words dn_children dn_child_nodes dn_options dn_option_ids
|
|
133
136
|
local -a dn_option_values dn_option_actions dn_choices
|
|
134
|
-
local -a dn_option_empty dn_option_repeats dn_value_choices
|
|
137
|
+
local -a dn_option_empty dn_option_repeats dn_value_choices dn_argument_empty
|
|
135
138
|
local dn_node=0 dn_position=0 dn_argument_count=0 dn_count=0 dn_pending=''
|
|
136
139
|
local dn_value_option=-1 dn_value_match=-1 dn_inline=0 dn_options_terminated=0 dn_allow_terminator=0
|
|
137
140
|
local dn_used='|' dn_tilde dn_current dn_word dn_index dn_match dn_option
|
|
@@ -194,7 +197,7 @@ const runtime = String.raw `
|
|
|
194
197
|
continue
|
|
195
198
|
fi
|
|
196
199
|
((dn_position < dn_argument_count)) || return 0
|
|
197
|
-
[[ -n "$dn_word" ]] || return 0
|
|
200
|
+
[[ -n "$dn_word" || "@{dn_argument_empty[dn_position]}" == 1 ]] || return 0
|
|
198
201
|
if ((@{#dn_choices[@]} > 0)); then
|
|
199
202
|
dn_match=0
|
|
200
203
|
for dn_choice in "@{dn_choices[@]}"; do
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bash.js","sourceRoot":"","sources":["../../../src/commands/completion/bash.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bash.js","sourceRoot":"","sources":["../../../src/commands/completion/bash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAA0B,MAAM,qBAAqB,CAAC;AAEvF,MAAM,UAAU,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC;AACpF,MAAM,UAAU,GAAG,CAAC,MAAyB,EAAU,EAAE,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;AAElG,MAAM,YAAY,GAAG,CAAC,IAAuB,EAAU,EAAE;IACvD,MAAM,KAAK,GAAwB,CAAC,IAAI,CAAC,CAAC;IAC1C,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACrD,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAE,CAAC;QAC3B,wBAAwB,CAAC,IAAI,CAAC,CAAC;QAC/B,MAAM,UAAU,GAAa,EAAE,CAAC;QAChC,MAAM,UAAU,GAAa,EAAE,CAAC;QAChC,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,IAAI,EAAE,EAAE,CAAC;YACxC,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC;YAChC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAClB,KAAK,MAA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
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { validateCommandArguments } from "../../cli/schema.js";
|
|
1
2
|
const quote = (value) => `'${value.replaceAll("'", "'\\''")}'`;
|
|
2
3
|
const escapeSpecification = (value) => value.replaceAll(/([\\\[\]:])/g, "\\$1");
|
|
3
4
|
const escapeDescription = (value) => value.replaceAll(/([\\:])/g, "\\$1");
|
|
@@ -15,6 +16,7 @@ const valueValidation = (option, variable, indentation) => [
|
|
|
15
16
|
].filter((line) => line !== "").join("\n");
|
|
16
17
|
// _arguments tolerates unknown options and excess positionals; completion must retain the CLI's grammar.
|
|
17
18
|
const renderPrefixValidation = (command) => {
|
|
19
|
+
validateCommandArguments(command);
|
|
18
20
|
if (command.commands !== undefined) {
|
|
19
21
|
const names = command.commands.flatMap((child) => [child.name, ...(child.aliases ?? [])]);
|
|
20
22
|
return ` if (( CURRENT > 2 )); then
|
|
@@ -27,14 +29,12 @@ const renderPrefixValidation = (command) => {
|
|
|
27
29
|
}
|
|
28
30
|
const options = command.options?.filter((option) => option.action === undefined) ?? [];
|
|
29
31
|
const arguments_ = command.arguments ?? [];
|
|
30
|
-
const positionalValidation = arguments_.length === 0 ? " return 1" : `
|
|
31
|
-
|
|
32
|
-
${
|
|
33
|
-
case "$word" in
|
|
32
|
+
const positionalValidation = arguments_.length === 0 ? " return 1" : ` case "$positional_count" in
|
|
33
|
+
${arguments_.map((argument, index) => ` ${index})
|
|
34
|
+
${argument.allowEmpty === true ? "" : ` [[ -n "$word" ]] || return 1\n`}${argument.choices === undefined ? "" : ` case "$word" in
|
|
34
35
|
${argument.choices.map(quote).join("|")}) ;;
|
|
35
36
|
*) return 1 ;;
|
|
36
|
-
esac
|
|
37
|
-
;;`}`).join("\n")}
|
|
37
|
+
esac\n`} ;;`).join("\n")}
|
|
38
38
|
*) return 1 ;;
|
|
39
39
|
esac
|
|
40
40
|
(( positional_count++ ))`;
|
|
@@ -112,7 +112,7 @@ ${children.map(({ command: child, functionName: childFunction }) => ` ${[
|
|
|
112
112
|
else {
|
|
113
113
|
for (const [index, argument] of (command.arguments ?? []).entries()) {
|
|
114
114
|
const state = `argument_${index + 1}`;
|
|
115
|
-
const specification = `${index + 1}
|
|
115
|
+
const specification = `${index + 1}${argument.optional === true ? "::" : ":"}${escapeSpecification(argument.description)}:->${state}`;
|
|
116
116
|
if (argument.choices === undefined) {
|
|
117
117
|
// zsh hides options beside a positional state unless the option prefix is present.
|
|
118
118
|
// An unstarted free-form value has no candidates, so omit its state until needed.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zsh.js","sourceRoot":"","sources":["../../../src/commands/completion/zsh.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"zsh.js","sourceRoot":"","sources":["../../../src/commands/completion/zsh.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAA8C,MAAM,qBAAqB,CAAC;AAE3G,MAAM,KAAK,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC;AAC/E,MAAM,mBAAmB,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;AAChG,MAAM,iBAAiB,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;AAE1F,MAAM,oBAAoB,GAAG,CAAC,MAAqB,EAAqB,EAAE;IACxE,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IACzG,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,EAAE,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,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AC,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,4CAA4C,OAAO,CAAC,sBAAsB,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;EACxU,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,uBAAuB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY;EAC/E,CAAC,CAAC;QACA,OAAO,YAAY,CAAC;IACtB,CAAC,CAAC;IAEF,MAAM,YAAY,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;IACzC,OAAO;;oBAEW,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,iGAAiG,CAAC;;;;EAItI,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC;;;;;IAKpB,YAAY;;;oBAGI,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;CAC5E,CAAC;AACF,CAAC,CAAC"}
|
|
@@ -1,168 +1,58 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: using-daynight
|
|
3
|
-
description: Manage
|
|
3
|
+
description: Manage projects, tasks, attachments, and Goals with the Daynight CLI; create tasks, execute a specified task, or review a handoff. Use only when explicitly invoked or the context clearly requires Daynight.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Using Daynight
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
with a
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
execution
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
and
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
and
|
|
59
|
-
helpers. Handle discovered product defects within the authorized implementation
|
|
60
|
-
scope.
|
|
61
|
-
|
|
62
|
-
Implementation and authorized defect-fix tasks retain their normal unit,
|
|
63
|
-
integration, and regression tests and required repository checks. A user-requested
|
|
64
|
-
maintained testing or automation capability is a development deliverable governed
|
|
65
|
-
by its own confirmed scope; do not infer it from a final-acceptance assignment.
|
|
66
|
-
|
|
67
|
-
## Select a mode
|
|
68
|
-
|
|
69
|
-
The following are skill modes, not additional CLI commands. Read only the
|
|
70
|
-
selected reference, then use [the handbook](references/handbook.md) for the
|
|
71
|
-
operations it requires. Do not load every mode by default.
|
|
72
|
-
|
|
73
|
-
| Mode | Use when | Reference |
|
|
74
|
-
|---|---|---|
|
|
75
|
-
| `handbook` | Answering usage questions or performing requested task-management operations | [Handbook](references/handbook.md) |
|
|
76
|
-
| `create-task <request>` | Preparing or registering persistent work explicitly requested by the user | [Create task](references/create-task.md) |
|
|
77
|
-
| `run-task <task-id>` | Executing one specified ordinary task | [Run task](references/run-task.md) |
|
|
78
|
-
| `handoff <task-id>` | Reviewing an explicitly requested task for handoff and enabling permission after it passes | [Handoff](references/handoff.md) |
|
|
79
|
-
| `autopilot-managed-task <task-id>` | The worker startup prompt explicitly declares the `worker-managed` environment, this skill, and this mode | [Managed autopilot](references/autopilot-managed-task.md) |
|
|
80
|
-
|
|
81
|
-
The managed execution reference is loaded only for that explicit worker launch;
|
|
82
|
-
ordinary calls do not read it. Task properties, the working directory, and
|
|
83
|
-
environment variables do not select the managed mode. An invocation presented
|
|
84
|
-
as managed with an incomplete launch declaration waits for the missing context.
|
|
85
|
-
A valid worker-managed assignment already carries sufficient authorization for
|
|
86
|
-
its in-scope delivery, including PR merge; deliver it without additional permission
|
|
87
|
-
requests once the required conditions are met. Explicit user restrictions, pause,
|
|
88
|
-
and revocation still apply. The mode executes only that original assignment;
|
|
89
|
-
reading its name does not authorize work or successor selection.
|
|
90
|
-
|
|
91
|
-
For ordinary calls, honor the explicitly selected mode. For `using-daynight`
|
|
92
|
-
without further input, infer the ordinary mode and target from the current
|
|
93
|
-
request and conversation. If context is insufficient or ambiguous, ask what the
|
|
94
|
-
user intends. Do not default to `handbook` or select a task merely because one
|
|
95
|
-
is ready. This skill does not discover and continuously select subsequent tasks.
|
|
96
|
-
|
|
97
|
-
## Shared constraints
|
|
98
|
-
|
|
99
|
-
- Create tasks only with explicit permission for their scope. Implementation
|
|
100
|
-
requests, tracking needs, and inferred mode selection alone do not grant
|
|
101
|
-
creation permission. An explicit user or applicable repository instruction
|
|
102
|
-
requiring Daynight tracking or review is standing creation permission for the
|
|
103
|
-
necessary tasks within the user's confirmed scope; reuse suitable existing
|
|
104
|
-
tasks and do not ask for that permission again. Permission to create a Goal
|
|
105
|
-
covers its discussion stages and confirmed in-scope breakdown, created only at
|
|
106
|
-
the user-confirmation gates in the Goal protocol; unrelated work needs
|
|
107
|
-
separate permission.
|
|
108
|
-
- Creation produces `todo` for every normal task and Goal stage and does not
|
|
109
|
-
start execution. A request to start a Goal discussion authorizes entering
|
|
110
|
-
`in_progress` for that discussion only; a user-confirmed transition authorizes
|
|
111
|
-
the next discussion under the Goal protocol. Registration and discussion
|
|
112
|
-
confirmation grant no delivery execution permission. Existing explicit
|
|
113
|
-
execution authorization remains limited to its stated task or Goal scope.
|
|
114
|
-
- Use a normal task for one independently tracked outcome. Work requiring
|
|
115
|
-
multiple independently tracked delivery stages is a Goal, expressed through
|
|
116
|
-
existing tasks and `dependsOn`. Read [the Goal protocol](references/goal.md)
|
|
117
|
-
when creating, executing, or advancing such a chain.
|
|
118
|
-
- Advance one specified task at a time, including CI, review, and merge waits.
|
|
119
|
-
Subagents collaborate on that task. Execution returns after its task completes
|
|
120
|
-
or requires external intervention; only ordinary execution may follow an
|
|
121
|
-
explicit user-directed discussion transition under the Goal protocol. Task
|
|
122
|
-
registration, completion, and discussion confirmation never select later
|
|
123
|
-
delivery work.
|
|
124
|
-
- Keep execution, analysis, questions, proposals, and task discussions within the
|
|
125
|
-
current task's confirmed objective, scope, deliverables, and acceptance criteria.
|
|
126
|
-
Apply this boundary to subagents. Read parent Goal materials, shared architecture,
|
|
127
|
-
and sibling or successor tasks as needed to understand this task's required
|
|
128
|
-
inputs, interfaces, and constraints; reading them does not expand its scope.
|
|
129
|
-
Report cross-task blockers and follow-up proposals without treating them as
|
|
130
|
-
authorization to create or execute other tasks. Expanding the current task's
|
|
131
|
-
scope requires explicit user confirmation. A Goal discussion or final-acceptance
|
|
132
|
-
task may cover the whole Goal when that is its confirmed scope.
|
|
133
|
-
- Use the shared [task content standard](references/task-content.md) when
|
|
134
|
-
creating, breaking down, handing off, or executing tasks. The description and
|
|
135
|
-
actual references jointly supply the task definition and produced results;
|
|
136
|
-
complete inline content needs no primary attachment. Keep execution and
|
|
137
|
-
discussion methods and processes in the session. Confirm resources before
|
|
138
|
-
linking and keep shared sources at their real owner. Each Goal delivery
|
|
139
|
-
description directly identifies the architecture task and every required source
|
|
140
|
-
location, including
|
|
141
|
-
inline description sections and full paths for actual attachment documents,
|
|
142
|
-
even for indirect successors, under the Goal protocol's readback rules. Express
|
|
143
|
-
necessary direct prerequisites through complete `dependsOn` and its
|
|
144
|
-
`externalDependsOn` subset. Omit redundant transitive dependencies under
|
|
145
|
-
[the handbook's reduction rule](references/handbook.md#dependency-reduction).
|
|
146
|
-
Same-chain prerequisites are ordinary; verified cross-chain prerequisites are
|
|
147
|
-
external. Both block execution. CLI dependency options replace the full sets;
|
|
148
|
-
preserve required relationships as the handbook requires.
|
|
149
|
-
- Task creation and execution do not enable `allowAgents`. Only an explicitly
|
|
150
|
-
authorized [handoff](references/handoff.md) may enable it after content review;
|
|
151
|
-
handoff does not start execution or replace other authority. Ordinary explicit
|
|
152
|
-
task execution does not require automatic-selection permission or platform
|
|
153
|
-
compatibility; dependencies, stage inputs, and execution authorization still
|
|
154
|
-
apply. Automatic worker eligibility remains governed by the service and worker.
|
|
155
|
-
- Preserve the exact version observed when deciding a metadata update,
|
|
156
|
-
`task set-status` change, or authorized `task delete`. Deletion retains stored
|
|
157
|
-
data and attachments and requires explicit authorization for the target task.
|
|
158
|
-
Add `--remove-depends` only when explicitly authorized to remove other tasks'
|
|
159
|
-
ordinary and external dependencies on that task; omission keeps strict deletion.
|
|
160
|
-
Generic updates cannot change status. Confirm writes,
|
|
161
|
-
reconcile uncertain results before further mutations, and preserve actual
|
|
162
|
-
failures. The handbook explains operational context; installed CLI help owns
|
|
163
|
-
command usage.
|
|
164
|
-
- Follow the target repository's delivery rules and the user's authorization.
|
|
165
|
-
When task acceptance includes PR delivery, a request to leave that PR for user
|
|
166
|
-
review keeps the task `in_progress`. A Daynight discussion uses its own
|
|
167
|
-
user-confirmation gate unless PR delivery is explicitly part of its acceptance.
|
|
168
|
-
Completion rules grant no merge authority.
|
|
8
|
+
Daynight manages and schedules projects and tasks for people and agents.
|
|
9
|
+
Use the `daynight` CLI to operate it and [Daynight](https://daynight.cc) to browse projects, tasks, and delivery materials.
|
|
10
|
+
|
|
11
|
+
## Capabilities and concepts
|
|
12
|
+
|
|
13
|
+
| Concept | Meaning and capabilities |
|
|
14
|
+
| --- | --- |
|
|
15
|
+
| Project | A project associated with a Git repository, organizing tasks and project access. |
|
|
16
|
+
| Task | An independently tracked work item with a description, status, dependencies, execution requirements, and PR references. In this skill, "task" means this object. |
|
|
17
|
+
| Goal | A complete objective expressed through tasks and their dependencies, including requirements discussion, solution discussion, and delivery work; not a separate resource. |
|
|
18
|
+
| Attachment | A task's independent attachment area for inputs and results such as documents, prototypes, and images. |
|
|
19
|
+
| worker-managed | An execution environment assigned and managed by `daynight worker`; the agent executes only its explicit assignment. |
|
|
20
|
+
|
|
21
|
+
The CLI supports project registration and lookup, task creation and filtering, status and dependency management, property values and definitions, attachment reads and writes, and worker-managed execution.
|
|
22
|
+
Creation, execution, and handoff are separate operations; see [authorization and scope](references/authorization.md).
|
|
23
|
+
|
|
24
|
+
## Setup and CLI
|
|
25
|
+
|
|
26
|
+
Read [setup](references/setup.md) when first connecting or switching repositories.
|
|
27
|
+
If the CLI is missing, obtain user authorization and follow the [installation guide](https://daynight.cc/setup).
|
|
28
|
+
|
|
29
|
+
See the [CLI handbook](references/handbook.md) for command entry points.
|
|
30
|
+
Use `daynight --help` and the relevant subcommand's `--help` for arguments and option combinations.
|
|
31
|
+
|
|
32
|
+
## Read by purpose
|
|
33
|
+
|
|
34
|
+
Read only the files and required references for the current operation, not every document by default.
|
|
35
|
+
|
|
36
|
+
| Purpose | Reference and responsibility |
|
|
37
|
+
| --- | --- |
|
|
38
|
+
| Determine permitted work and required authorization | [Authorization and scope](references/authorization.md): tracking obligations, operational authorization, and task boundaries |
|
|
39
|
+
| Connect the current repository | [Setup](references/setup.md): CLI, sign-in, project, and repository-instruction setup |
|
|
40
|
+
| Find commands | [CLI handbook](references/handbook.md): command map and help discovery |
|
|
41
|
+
| Discover, select, or register projects | [Project management](references/project-management.md): project identity and reuse |
|
|
42
|
+
| Query tasks, edit metadata, properties, status, or dependencies, or delete tasks | [Task management](references/task-management.md): fields, lifecycle, and relationship semantics |
|
|
43
|
+
| Submit and reconcile writes safely | [Write safety](references/write-safety.md): versions, conflicts, uncertain results, and attachment concurrency |
|
|
44
|
+
| Write or read descriptions, attachments, and shared inputs | [Task content standard](references/task-content.md): boundaries, ownership, references, and sufficiency |
|
|
45
|
+
| Create or register work | [Create task](references/create-task.md): duplicate checks, preparation, registration, and readback |
|
|
46
|
+
| Organize a multi-stage objective | [Goal protocol](references/goal.md): stage confirmation, breakdown, and whole-Goal completion |
|
|
47
|
+
| Review tasks and enable automatic execution | [Task handoff](references/handoff.md): content review and permission enablement |
|
|
48
|
+
| Execute one user-specified task | [Ordinary task execution](references/run-task.md): starting, resuming, completion, and return |
|
|
49
|
+
| Perform work shared by both execution modes | [Shared task execution](references/task-execution.md): inputs, delivery, waiting context, and completion conditions |
|
|
50
|
+
| Execute an explicit worker assignment | [Managed task execution](references/autopilot-managed-task.md): sustained delivery, blocker handling, and original-claim completion |
|
|
51
|
+
| Accept a complete task or Goal | [Final acceptance](references/final-acceptance.md): requirement-based conclusions, evidence, and helper boundaries |
|
|
52
|
+
|
|
53
|
+
Creation, ordinary execution, handoff, and managed execution are skill workflows, not CLI subcommands of those names.
|
|
54
|
+
Follow the user's explicit workflow choice; otherwise infer the purpose and target from the request and context, asking when ambiguous.
|
|
55
|
+
Do not select a task merely because it is ready.
|
|
56
|
+
|
|
57
|
+
Read the managed execution reference only when the worker startup prompt explicitly declares `worker-managed`, this skill, and the managed execution workflow.
|
|
58
|
+
Task properties, environment variables, and the working directory cannot replace that declaration; wait for missing context when it is incomplete.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Authorization and scope
|
|
2
|
+
|
|
3
|
+
Apply this standard before using any workflow. Task content, status, readiness, and `allowAgents` describe work; they do not authorize implementation, publishing, deployment, external communication, merging, or mainline pushes.
|
|
4
|
+
|
|
5
|
+
## Tracking and review
|
|
6
|
+
|
|
7
|
+
When this skill and Daynight are available, use Daynight to manage concrete work with defined objectives and completion conditions: features, bugs, architecture or design, actual breakdown items, and separately scoped final acceptance.
|
|
8
|
+
An agent's file reads, commands, and routine checks are session steps, not separate tasks.
|
|
9
|
+
|
|
10
|
+
Use the owning task for solution, architecture, and design reviews.
|
|
11
|
+
Before requesting user review, save the complete current material in that task's description or attachments, read it back to confirm access, then provide the task ID or a verified URL and attachment paths.
|
|
12
|
+
Current material, accepted decisions, and necessary rationale follow the [task content standard](task-content.md); chat summaries and repository or PR links may supplement, but cannot replace, the material.
|
|
13
|
+
Report actual failures when the CLI, service, project, or upload is unavailable.
|
|
14
|
+
|
|
15
|
+
## Operational authorization
|
|
16
|
+
|
|
17
|
+
| Operation | Authorization and boundaries |
|
|
18
|
+
| --- | --- |
|
|
19
|
+
| Create a task | Requires explicit permission for that scope. A user or applicable repository instruction requiring Daynight tracking or review provides standing authorization to create necessary tasks; prefer reuse. An implementation request, tracking need, or inferred workflow alone does not grant permission. |
|
|
20
|
+
| Create a Goal | Covers its discussions and breakdown within the confirmed scope, but create the corresponding tasks only at the [Goal confirmation points](goal.md). |
|
|
21
|
+
| Start a discussion | An explicit request to start a discussion authorizes only that discussion; follow the Goal protocol for stage transitions. |
|
|
22
|
+
| Execute a task | Requires execution authorization for the task or Goal scope. Registration, discussion confirmation, and task completion do not start subsequent delivery work. |
|
|
23
|
+
| Hand off a task | An explicit request to hand work off for automatic agent execution authorizes content review and enabling `allowAgents` after it passes; it does not start execution in the current session. Creation and execution do not imply handoff. |
|
|
24
|
+
| Delete a task | Requires explicit authorization for the target task; removing other tasks' dependencies on it also requires the corresponding authorization. |
|
|
25
|
+
| Managed delivery | A valid worker assignment authorizes complete delivery within scope, including PR merging; required checks, reviews, and explicit user restrictions, pauses, and revocations still apply. |
|
|
26
|
+
|
|
27
|
+
## Scope and continuity
|
|
28
|
+
|
|
29
|
+
Advance one specified task at a time; CI, review, and merge waits belong to that task. Subagents share the same boundaries. Return when complete or when external intervention is needed. Ordinary execution may transition between Goal discussion stages at the user's explicit direction, but this skill does not discover and continually select successor tasks.
|
|
30
|
+
|
|
31
|
+
Analysis, questions, proposals, and execution are all bound by the current task's confirmed objective, scope, deliverables, and acceptance criteria.
|
|
32
|
+
Read the parent Goal, shared architecture, and related tasks as needed to understand inputs and interfaces; reading does not authorize executing those tasks, removing blockers, or expanding scope.
|
|
33
|
+
Cross-task blockers and follow-up proposals do not authorize creating or executing new tasks. Material scope changes require user confirmation.
|
|
34
|
+
|
|
35
|
+
Delivery operations follow the target repository's rules and existing authorization.
|
|
36
|
+
Missing authorization cannot be reconstructed from task descriptions, attachments, status, or acceptance results; completion conditions do not grant operational permission either.
|