@codyswann/lisa 8.10.2 → 8.10.4
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/core/nightly-e2e-guard-behavior-certificate.js +2 -2
- package/dist/core/upstream-evidence-manifest.json +29 -9
- package/dist/opencode/plugin-templates/task-readiness-guard.mjs +1 -1
- package/package.json +4 -4
- package/plugins/lisa/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-secrets-access/scripts/preflight-secrets.mjs +21 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-secrets-access/scripts/task-action.mjs +35 -6
- package/plugins/lisa/.codex-plugin/skills/lisa-secrets-access/scripts/task-intake-read.mjs +1 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-secrets-access/scripts/task-tracker-create.mjs +423 -0
- package/plugins/lisa/.codex-plugin/skills/lisa-secrets-access/scripts/task-tracker-intake.mjs +72 -14
- package/plugins/lisa/.codex-plugin/skills/lisa-secrets-access/scripts/task-unbound.mjs +13 -3
- package/plugins/lisa/.codex-plugin/skills/lisa-tracker-write/SKILL.md +2 -0
- package/plugins/lisa/hooks/task-readiness-guard.mjs +1 -1
- package/plugins/lisa/rules/reference/tool-access-gate.md +21 -2
- package/plugins/lisa/rules/reference/tracked-work.md +4 -1
- package/plugins/lisa/skills/lisa-secrets-access/scripts/preflight-secrets.mjs +21 -1
- package/plugins/lisa/skills/lisa-secrets-access/scripts/task-action.mjs +35 -6
- package/plugins/lisa/skills/lisa-secrets-access/scripts/task-intake-read.mjs +1 -1
- package/plugins/lisa/skills/lisa-secrets-access/scripts/task-tracker-create.mjs +423 -0
- package/plugins/lisa/skills/lisa-secrets-access/scripts/task-tracker-intake.mjs +72 -14
- package/plugins/lisa/skills/lisa-secrets-access/scripts/task-unbound.mjs +13 -3
- package/plugins/lisa/skills/lisa-tracker-write/SKILL.md +2 -0
- package/plugins/lisa-agy/plugin.json +1 -1
- package/plugins/lisa-agy/skills/lisa-secrets-access/scripts/preflight-secrets.mjs +21 -1
- package/plugins/lisa-agy/skills/lisa-secrets-access/scripts/task-action.mjs +35 -6
- package/plugins/lisa-agy/skills/lisa-secrets-access/scripts/task-intake-read.mjs +1 -1
- package/plugins/lisa-agy/skills/lisa-secrets-access/scripts/task-tracker-create.mjs +423 -0
- package/plugins/lisa-agy/skills/lisa-secrets-access/scripts/task-tracker-intake.mjs +72 -14
- package/plugins/lisa-agy/skills/lisa-secrets-access/scripts/task-unbound.mjs +13 -3
- package/plugins/lisa-agy/skills/lisa-tracker-write/SKILL.md +2 -0
- package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-agy/plugin.json +1 -1
- package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/hooks/task-readiness-guard.mjs +1 -1
- package/plugins/lisa-copilot/rules/reference/tool-access-gate.md +21 -2
- package/plugins/lisa-copilot/rules/reference/tracked-work.md +4 -1
- package/plugins/lisa-copilot/skills/lisa-secrets-access/scripts/preflight-secrets.mjs +21 -1
- package/plugins/lisa-copilot/skills/lisa-secrets-access/scripts/task-action.mjs +35 -6
- package/plugins/lisa-copilot/skills/lisa-secrets-access/scripts/task-intake-read.mjs +1 -1
- package/plugins/lisa-copilot/skills/lisa-secrets-access/scripts/task-tracker-create.mjs +423 -0
- package/plugins/lisa-copilot/skills/lisa-secrets-access/scripts/task-tracker-intake.mjs +72 -14
- package/plugins/lisa-copilot/skills/lisa-secrets-access/scripts/task-unbound.mjs +13 -3
- package/plugins/lisa-copilot/skills/lisa-tracker-write/SKILL.md +2 -0
- package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cursor/hooks/task-readiness-guard.mjs +1 -1
- package/plugins/lisa-cursor/rules/tool-access-gate-reference.mdc +21 -2
- package/plugins/lisa-cursor/rules/tracked-work-reference.mdc +4 -1
- package/plugins/lisa-cursor/skills/lisa-secrets-access/scripts/preflight-secrets.mjs +21 -1
- package/plugins/lisa-cursor/skills/lisa-secrets-access/scripts/task-action.mjs +35 -6
- package/plugins/lisa-cursor/skills/lisa-secrets-access/scripts/task-intake-read.mjs +1 -1
- package/plugins/lisa-cursor/skills/lisa-secrets-access/scripts/task-tracker-create.mjs +423 -0
- package/plugins/lisa-cursor/skills/lisa-secrets-access/scripts/task-tracker-intake.mjs +72 -14
- package/plugins/lisa-cursor/skills/lisa-secrets-access/scripts/task-unbound.mjs +13 -3
- package/plugins/lisa-cursor/skills/lisa-tracker-write/SKILL.md +2 -0
- package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/hooks/task-readiness-guard.mjs +1 -1
- package/plugins/lisa-devin/rules/reference/tool-access-gate.md +21 -2
- package/plugins/lisa-devin/rules/reference/tracked-work.md +4 -1
- package/plugins/lisa-devin/skills/lisa-secrets-access/scripts/preflight-secrets.mjs +21 -1
- package/plugins/lisa-devin/skills/lisa-secrets-access/scripts/task-action.mjs +35 -6
- package/plugins/lisa-devin/skills/lisa-secrets-access/scripts/task-intake-read.mjs +1 -1
- package/plugins/lisa-devin/skills/lisa-secrets-access/scripts/task-tracker-create.mjs +423 -0
- package/plugins/lisa-devin/skills/lisa-secrets-access/scripts/task-tracker-intake.mjs +72 -14
- package/plugins/lisa-devin/skills/lisa-secrets-access/scripts/task-unbound.mjs +13 -3
- package/plugins/lisa-devin/skills/lisa-tracker-write/SKILL.md +2 -0
- package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-agy/plugin.json +1 -1
- package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-agy/plugin.json +1 -1
- package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-agy/plugin.json +1 -1
- package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-agy/plugin.json +1 -1
- package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-agy/plugin.json +1 -1
- package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-agy/plugin.json +1 -1
- package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/src/base/hooks/task-readiness-guard.mjs +1 -1
- package/plugins/src/base/rules/reference/tool-access-gate.md +21 -2
- package/plugins/src/base/rules/reference/tracked-work.md +4 -1
- package/plugins/src/base/skills/lisa-secrets-access/scripts/preflight-secrets.mjs +21 -1
- package/plugins/src/base/skills/lisa-secrets-access/scripts/task-action.mjs +35 -6
- package/plugins/src/base/skills/lisa-secrets-access/scripts/task-intake-read.mjs +1 -1
- package/plugins/src/base/skills/lisa-secrets-access/scripts/task-tracker-create.mjs +423 -0
- package/plugins/src/base/skills/lisa-secrets-access/scripts/task-tracker-intake.mjs +72 -14
- package/plugins/src/base/skills/lisa-secrets-access/scripts/task-unbound.mjs +13 -3
- package/plugins/src/base/skills/lisa-tracker-write/SKILL.md +2 -0
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File one ticket in the configured tracker, from a file, for a session with
|
|
3
|
+
* no ticket bound (CodySwannGT/lisa#5198).
|
|
4
|
+
*
|
|
5
|
+
* The task-readiness guard refuses every tracker write while no ticket is
|
|
6
|
+
* bound, so a session asked to "fix this" could not file the ticket the work
|
|
7
|
+
* needs first. This is the one write it may make: the guard admits exactly
|
|
8
|
+
* `node <owner> --tracker-create --input-file <file>`, the file sits outside
|
|
9
|
+
* every repository (an agent's shell has no stdin), and this owner always
|
|
10
|
+
* files into the configured repository, team or project. The input cannot
|
|
11
|
+
* name another one.
|
|
12
|
+
*
|
|
13
|
+
* The readiness declaration `block-direct-issue-create` demands is enforced
|
|
14
|
+
* here as well, so this path is never a way around it. The input says which
|
|
15
|
+
* of the three it is, and the body has to agree:
|
|
16
|
+
*
|
|
17
|
+
* - `build-ready`: this owner applies the configured ready role itself (the
|
|
18
|
+
* GitHub label, or the Linear/Jira workflow state);
|
|
19
|
+
* - `human-gate`: the body declares a `[lisa-human-gate]` hold;
|
|
20
|
+
* - `container`: the body carries the canonical container line and the item
|
|
21
|
+
* names no by-design leaf type.
|
|
22
|
+
* @module task-tracker-create
|
|
23
|
+
*/
|
|
24
|
+
import { execFileSync } from "node:child_process";
|
|
25
|
+
import { readFileSync } from "node:fs";
|
|
26
|
+
import { AccessFailure, plainObject } from "./config-layers.mjs";
|
|
27
|
+
import { readTaskConfig } from "./surfaces.mjs";
|
|
28
|
+
import { failure } from "./task-readiness.mjs";
|
|
29
|
+
import { outsideEveryRepository } from "./task-unbound.mjs";
|
|
30
|
+
import { selectedAccess } from "./task-intake-read.mjs";
|
|
31
|
+
import { githubEnvironment } from "./task-github.mjs";
|
|
32
|
+
import { jiraApi, linearRequest } from "./task-tracker-intake.mjs";
|
|
33
|
+
import { configuredIssueRepository } from "../../lisa-github-read-issue/read-contract.mjs";
|
|
34
|
+
import { markdownToAdf } from "../../lisa-atlassian-access/scripts/markdown-to-adf.mjs";
|
|
35
|
+
import { bodyDeclaresHold } from "../../../scripts/intake-blocker-reprobe.mjs";
|
|
36
|
+
import {
|
|
37
|
+
OUTCOMES,
|
|
38
|
+
resolveRole,
|
|
39
|
+
} from "../../../scripts/resolve-lifecycle-role.mjs";
|
|
40
|
+
|
|
41
|
+
/** The code every refusal of this command's own rules carries. */
|
|
42
|
+
export const REFUSED = "tracker-create-refused";
|
|
43
|
+
const READINESS = ["build-ready", "human-gate", "container"];
|
|
44
|
+
const FIELDS = ["title", "body", "labels", "readiness", "issue_type"];
|
|
45
|
+
const CONTAINER =
|
|
46
|
+
/None\s*[—–-]\s*container:\s*state\s+rolls\s+up\s+from\s+children/iu;
|
|
47
|
+
const LEAF_TYPES = ["bug", "task", "sub-task", "subtask", "improvement"];
|
|
48
|
+
const MAX_BODY = 65536;
|
|
49
|
+
const MAX_TITLE = 256;
|
|
50
|
+
|
|
51
|
+
/** A refusal of this command's own rules, said in words the agent can act on. */
|
|
52
|
+
class CreateRefusal extends Error {}
|
|
53
|
+
|
|
54
|
+
const refuse = reason => {
|
|
55
|
+
throw new CreateRefusal(reason);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Validate the input file's object. Unknown fields are refused, so the input
|
|
60
|
+
* cannot carry a repository, team or project of its own.
|
|
61
|
+
* @param {unknown} input Parsed input file.
|
|
62
|
+
* @returns {{title: string, body: string, labels: string[], readiness: string, issueType: string|undefined}} The request.
|
|
63
|
+
*/
|
|
64
|
+
export function createRequest(input) {
|
|
65
|
+
if (!plainObject(input)) refuse("the input file must hold one JSON object.");
|
|
66
|
+
const unknown = Object.keys(input).filter(key => !FIELDS.includes(key));
|
|
67
|
+
if (unknown.length)
|
|
68
|
+
refuse(
|
|
69
|
+
`unknown field ${unknown.join(", ")}; the fields are ${FIELDS.join(", ")}. The ticket is always filed in this project's configured tracker.`
|
|
70
|
+
);
|
|
71
|
+
const { title, body, labels = [], readiness, issue_type: issueType } = input;
|
|
72
|
+
if (
|
|
73
|
+
typeof title !== "string" ||
|
|
74
|
+
!title.trim() ||
|
|
75
|
+
title.length > MAX_TITLE ||
|
|
76
|
+
/[\r\n]/u.test(title)
|
|
77
|
+
)
|
|
78
|
+
refuse(`"title" must be one line of 1 to ${MAX_TITLE} characters.`);
|
|
79
|
+
if (typeof body !== "string" || !body.trim() || body.length > MAX_BODY)
|
|
80
|
+
refuse(
|
|
81
|
+
`"body" must be the ticket's full text, up to ${MAX_BODY} characters.`
|
|
82
|
+
);
|
|
83
|
+
if (
|
|
84
|
+
!Array.isArray(labels) ||
|
|
85
|
+
labels.length > 50 ||
|
|
86
|
+
!labels.every(
|
|
87
|
+
label =>
|
|
88
|
+
typeof label === "string" &&
|
|
89
|
+
label.trim() === label &&
|
|
90
|
+
label.length > 0 &&
|
|
91
|
+
label.length <= 100 &&
|
|
92
|
+
!label.includes(",")
|
|
93
|
+
)
|
|
94
|
+
)
|
|
95
|
+
refuse(
|
|
96
|
+
`"labels" must be a list of label names, each without commas or surrounding spaces.`
|
|
97
|
+
);
|
|
98
|
+
if (
|
|
99
|
+
issueType !== undefined &&
|
|
100
|
+
(typeof issueType !== "string" ||
|
|
101
|
+
!/^[A-Za-z][\w -]{0,40}$/u.test(issueType))
|
|
102
|
+
)
|
|
103
|
+
refuse(`"issue_type" must be a plain issue type name, such as "Task".`);
|
|
104
|
+
if (!READINESS.includes(readiness))
|
|
105
|
+
refuse(
|
|
106
|
+
`the filing declares no readiness. Set "readiness" to "build-ready" (complete enough to build), "human-gate" (a person must perform an act the agent cannot; the body must declare the [lisa-human-gate] hold), or "container" (an Epic whose state rolls up from its children). A filing without one is never picked up.`
|
|
107
|
+
);
|
|
108
|
+
return {
|
|
109
|
+
title,
|
|
110
|
+
body,
|
|
111
|
+
labels: [...new Set(labels)],
|
|
112
|
+
readiness,
|
|
113
|
+
issueType,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Check that the body and labels agree with the declared readiness.
|
|
119
|
+
* @param {ReturnType<typeof createRequest>} request The request.
|
|
120
|
+
* @param {string} readyLabel GitHub's configured ready label, else "".
|
|
121
|
+
* @returns {void}
|
|
122
|
+
*/
|
|
123
|
+
export function checkDeclaration(request, readyLabel = "") {
|
|
124
|
+
const { body, labels, readiness, issueType } = request;
|
|
125
|
+
const hold = bodyDeclaresHold(body);
|
|
126
|
+
const container = CONTAINER.test(body);
|
|
127
|
+
const leaf =
|
|
128
|
+
LEAF_TYPES.includes(String(issueType ?? "").toLowerCase()) ||
|
|
129
|
+
labels.some(label =>
|
|
130
|
+
LEAF_TYPES.some(type => label.toLowerCase() === `type:${type}`)
|
|
131
|
+
);
|
|
132
|
+
const ready = readyLabel !== "" && labels.includes(readyLabel);
|
|
133
|
+
if (readiness === "build-ready" && (hold || container))
|
|
134
|
+
refuse(
|
|
135
|
+
`"build-ready" contradicts the body, which declares ${hold ? "a [lisa-human-gate] hold" : "a container"}.`
|
|
136
|
+
);
|
|
137
|
+
if (readiness === "human-gate" && (!hold || container || ready))
|
|
138
|
+
refuse(
|
|
139
|
+
hold
|
|
140
|
+
? `a held ticket cannot also be ${container ? "a container" : `in the ready lane (${readyLabel})`}.`
|
|
141
|
+
: `"human-gate" needs a body line that declares the hold, such as "<!-- [lisa-human-gate] reason=<short-slug> -->", after a sentence naming the act a person must perform.`
|
|
142
|
+
);
|
|
143
|
+
if (readiness === "container" && (!container || hold || leaf || ready))
|
|
144
|
+
refuse(
|
|
145
|
+
container
|
|
146
|
+
? "a container cannot carry a hold, the ready role, or a by-design leaf type (Bug, Task, Sub-task, Improvement)."
|
|
147
|
+
: `"container" needs the body line "None — container: state rolls up from children" under "## Target Backend Environment".`
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/** The configured build-ready role for a state-based tracker, or a refusal. */
|
|
152
|
+
function readyState(cfg, vendor) {
|
|
153
|
+
const resolved = resolveRole({
|
|
154
|
+
role: "ready",
|
|
155
|
+
vendor,
|
|
156
|
+
intent: "write",
|
|
157
|
+
local: {},
|
|
158
|
+
global: cfg.effective,
|
|
159
|
+
});
|
|
160
|
+
if (resolved.outcome !== OUTCOMES.CONFIGURED || !resolved.value)
|
|
161
|
+
refuse(
|
|
162
|
+
`${vendor}.workflow.ready is not configured, so there is no ready state to file a build-ready ticket into.`
|
|
163
|
+
);
|
|
164
|
+
return resolved.value;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function createGithub(cfg, request) {
|
|
168
|
+
const repo = configuredIssueRepository(cfg.effective?.github);
|
|
169
|
+
if (!repo) throw new AccessFailure("config-invalid");
|
|
170
|
+
const ready = cfg.effective.github?.labels?.build?.ready || "status:ready";
|
|
171
|
+
checkDeclaration(request, ready);
|
|
172
|
+
const labels =
|
|
173
|
+
request.readiness === "build-ready"
|
|
174
|
+
? [...new Set([...request.labels, ready])]
|
|
175
|
+
: request.labels;
|
|
176
|
+
const env = githubEnvironment(selectedAccess(cfg, repo));
|
|
177
|
+
let raw;
|
|
178
|
+
try {
|
|
179
|
+
raw = execFileSync(
|
|
180
|
+
"gh",
|
|
181
|
+
[
|
|
182
|
+
"issue",
|
|
183
|
+
"create",
|
|
184
|
+
"--repo",
|
|
185
|
+
repo,
|
|
186
|
+
"--title",
|
|
187
|
+
request.title,
|
|
188
|
+
"--body-file",
|
|
189
|
+
"-",
|
|
190
|
+
...labels.flatMap(label => ["--label", label]),
|
|
191
|
+
],
|
|
192
|
+
{
|
|
193
|
+
env,
|
|
194
|
+
input: request.body,
|
|
195
|
+
encoding: "utf8",
|
|
196
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
197
|
+
timeout: 60000,
|
|
198
|
+
}
|
|
199
|
+
);
|
|
200
|
+
} catch (error) {
|
|
201
|
+
throw new AccessFailure(
|
|
202
|
+
error.code === "ENOENT" ? "tool-missing" : "capability-unreachable"
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
const url = raw.trim().split("\n").at(-1);
|
|
206
|
+
const number = new RegExp(
|
|
207
|
+
`^https://github\\.com/${repo}/issues/(\\d+)$`,
|
|
208
|
+
"u"
|
|
209
|
+
).exec(url)?.[1];
|
|
210
|
+
if (!number) throw new AccessFailure("capability-unreachable");
|
|
211
|
+
return { ref: `${repo}#${number}`, url };
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
const linearTeam =
|
|
215
|
+
"query($key:String!){teams(filter:{key:{eq:$key}}){nodes{id key states{nodes{id name}}}}}";
|
|
216
|
+
const linearLabels =
|
|
217
|
+
"query($names:[String!]!){issueLabels(first:250,filter:{name:{in:$names}}){nodes{id name team{key}}}}";
|
|
218
|
+
const linearCreate =
|
|
219
|
+
"mutation($input:IssueCreateInput!){issueCreate(input:$input){success issue{identifier url team{key}}}}";
|
|
220
|
+
|
|
221
|
+
/** Exactly one match, or a refusal naming what was looked for. */
|
|
222
|
+
function only(matches, what) {
|
|
223
|
+
if (matches.length !== 1)
|
|
224
|
+
refuse(
|
|
225
|
+
`${what} matched ${matches.length} entries in the configured Linear team; it must match exactly one.`
|
|
226
|
+
);
|
|
227
|
+
return matches[0];
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
function createLinear(cfg, request) {
|
|
231
|
+
checkDeclaration(request);
|
|
232
|
+
const teamKey = cfg.effective.linear?.teamKey;
|
|
233
|
+
const teams = linearRequest(cfg, linearTeam, { key: teamKey })?.data?.teams
|
|
234
|
+
?.nodes;
|
|
235
|
+
if (!Array.isArray(teams)) throw new AccessFailure("capability-unreachable");
|
|
236
|
+
const team = only(
|
|
237
|
+
teams.filter(node => node.key === teamKey),
|
|
238
|
+
`team ${teamKey}`
|
|
239
|
+
);
|
|
240
|
+
const input = {
|
|
241
|
+
teamId: team.id,
|
|
242
|
+
title: request.title,
|
|
243
|
+
description: request.body,
|
|
244
|
+
};
|
|
245
|
+
if (request.readiness === "build-ready") {
|
|
246
|
+
const name = readyState(cfg, "linear");
|
|
247
|
+
input.stateId = only(
|
|
248
|
+
(team.states?.nodes ?? []).filter(state => state.name === name),
|
|
249
|
+
`ready state "${name}"`
|
|
250
|
+
).id;
|
|
251
|
+
}
|
|
252
|
+
if (request.labels.length) {
|
|
253
|
+
const found = linearRequest(cfg, linearLabels, { names: request.labels })
|
|
254
|
+
?.data?.issueLabels?.nodes;
|
|
255
|
+
if (!Array.isArray(found))
|
|
256
|
+
throw new AccessFailure("capability-unreachable");
|
|
257
|
+
input.labelIds = request.labels.map(
|
|
258
|
+
name =>
|
|
259
|
+
only(
|
|
260
|
+
found.filter(
|
|
261
|
+
label =>
|
|
262
|
+
label.name === name && (!label.team || label.team.key === teamKey)
|
|
263
|
+
),
|
|
264
|
+
`label "${name}"`
|
|
265
|
+
).id
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
const created = linearRequest(cfg, linearCreate, { input })?.data
|
|
269
|
+
?.issueCreate;
|
|
270
|
+
const issue = created?.issue;
|
|
271
|
+
if (
|
|
272
|
+
created?.success !== true ||
|
|
273
|
+
issue?.team?.key !== teamKey ||
|
|
274
|
+
!new RegExp(`^${teamKey}-[1-9]\\d*$`, "u").test(issue.identifier ?? "")
|
|
275
|
+
)
|
|
276
|
+
throw new AccessFailure("capability-unreachable");
|
|
277
|
+
return { ref: issue.identifier, url: issue.url };
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
function createJira(cfg, request) {
|
|
281
|
+
const project = cfg.effective.jira?.project;
|
|
282
|
+
if (typeof project !== "string" || !/^[A-Z][A-Z0-9]*$/u.test(project))
|
|
283
|
+
throw new AccessFailure("config-invalid");
|
|
284
|
+
checkDeclaration(request);
|
|
285
|
+
if (request.labels.some(label => /\s/u.test(label)))
|
|
286
|
+
refuse("Jira labels cannot contain spaces.");
|
|
287
|
+
// Jira's default type is a leaf, so a container must name its own (an Epic).
|
|
288
|
+
if (request.readiness === "container" && !request.issueType)
|
|
289
|
+
refuse(
|
|
290
|
+
`a Jira container needs "issue_type", such as "Epic"; the default, Task, is a leaf type.`
|
|
291
|
+
);
|
|
292
|
+
const ready =
|
|
293
|
+
request.readiness === "build-ready" ? readyState(cfg, "jira") : null;
|
|
294
|
+
const api = jiraApi(cfg);
|
|
295
|
+
if (api.unavailable) throw new AccessFailure(api.unavailable);
|
|
296
|
+
const created = api.call("/issue", "POST", {
|
|
297
|
+
fields: {
|
|
298
|
+
project: { key: project },
|
|
299
|
+
summary: request.title,
|
|
300
|
+
description: markdownToAdf(request.body),
|
|
301
|
+
issuetype: { name: request.issueType ?? "Task" },
|
|
302
|
+
...(request.labels.length ? { labels: request.labels } : {}),
|
|
303
|
+
},
|
|
304
|
+
});
|
|
305
|
+
const key = created?.key;
|
|
306
|
+
if (!new RegExp(`^${project}-[1-9]\\d*$`, "u").test(key ?? ""))
|
|
307
|
+
throw new AccessFailure("capability-unreachable");
|
|
308
|
+
const site = cfg.effective.atlassian?.site;
|
|
309
|
+
const filed = {
|
|
310
|
+
ref: key,
|
|
311
|
+
url: site
|
|
312
|
+
? `${new URL(site.includes("://") ? site : `https://${site}`).origin}/browse/${key}`
|
|
313
|
+
: null,
|
|
314
|
+
};
|
|
315
|
+
if (ready) moveJira(api, filed, ready);
|
|
316
|
+
return filed;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Jira sets no status at creation, so a build-ready ticket is moved after.
|
|
321
|
+
* Any failure from here on still reports the ticket that now exists, so a
|
|
322
|
+
* retry never files it twice.
|
|
323
|
+
*/
|
|
324
|
+
function moveJira(api, filed, ready) {
|
|
325
|
+
try {
|
|
326
|
+
transitionJira(api, filed, ready);
|
|
327
|
+
} catch (error) {
|
|
328
|
+
if (error instanceof CreateRefusal) throw error;
|
|
329
|
+
throw Object.assign(
|
|
330
|
+
new CreateRefusal(
|
|
331
|
+
`${filed.ref} was created, but moving it into the ready state "${ready}" failed (${error instanceof AccessFailure ? error.code : "unexpected error"}), so it is not in the ready lane yet. Do not file it again; move it to "${ready}" through lisa-atlassian-access.`
|
|
332
|
+
),
|
|
333
|
+
{ filed }
|
|
334
|
+
);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
function transitionJira(api, filed, ready) {
|
|
339
|
+
const endpoint = `/issue/${filed.ref}`;
|
|
340
|
+
if (api.call(`${endpoint}?fields=status`)?.fields?.status?.name === ready)
|
|
341
|
+
return;
|
|
342
|
+
const moves = (api.call(`${endpoint}/transitions`)?.transitions ?? []).filter(
|
|
343
|
+
transition => transition.to?.name === ready
|
|
344
|
+
);
|
|
345
|
+
if (moves.length !== 1)
|
|
346
|
+
throw Object.assign(
|
|
347
|
+
new CreateRefusal(
|
|
348
|
+
`${filed.ref} was created, but it has no single transition into the ready state "${ready}", so it is not in the ready lane yet. Do not file it again; move it to "${ready}" through lisa-atlassian-access.`
|
|
349
|
+
),
|
|
350
|
+
{ filed }
|
|
351
|
+
);
|
|
352
|
+
api.call(`${endpoint}/transitions`, "POST", {
|
|
353
|
+
transition: { id: moves[0].id },
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
const creators = {
|
|
358
|
+
github: createGithub,
|
|
359
|
+
linear: createLinear,
|
|
360
|
+
jira: createJira,
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* Run `--tracker-create --input-file <file>` and print the filed ticket.
|
|
365
|
+
* @param {string[]} [args] Arguments after the script.
|
|
366
|
+
* @returns {void}
|
|
367
|
+
*/
|
|
368
|
+
export function runTrackerCreate(args = process.argv.slice(2)) {
|
|
369
|
+
let cfg, tracker;
|
|
370
|
+
try {
|
|
371
|
+
cfg = readTaskConfig();
|
|
372
|
+
tracker = cfg.effective?.tracker;
|
|
373
|
+
const [mode, flag, file] = args;
|
|
374
|
+
if (
|
|
375
|
+
args.length !== 3 ||
|
|
376
|
+
mode !== "--tracker-create" ||
|
|
377
|
+
flag !== "--input-file"
|
|
378
|
+
)
|
|
379
|
+
refuse("run exactly: --tracker-create --input-file <absolute path>.");
|
|
380
|
+
if (!outsideEveryRepository(file, cfg.projectRoot))
|
|
381
|
+
refuse(
|
|
382
|
+
"the input file must be an absolute path outside every git repository, such as a scratch file."
|
|
383
|
+
);
|
|
384
|
+
if (!Object.hasOwn(creators, tracker ?? ""))
|
|
385
|
+
throw new AccessFailure("config-invalid");
|
|
386
|
+
let input;
|
|
387
|
+
try {
|
|
388
|
+
input = JSON.parse(readFileSync(file, "utf8"));
|
|
389
|
+
} catch {
|
|
390
|
+
refuse("the input file could not be read as JSON.");
|
|
391
|
+
}
|
|
392
|
+
const filed = creators[tracker](cfg, createRequest(input));
|
|
393
|
+
console.log(JSON.stringify({ code: "tracker-created", ...filed }));
|
|
394
|
+
} catch (error) {
|
|
395
|
+
if (error instanceof CreateRefusal) {
|
|
396
|
+
if (error.filed)
|
|
397
|
+
console.log(
|
|
398
|
+
JSON.stringify({ code: "tracker-created", ...error.filed })
|
|
399
|
+
);
|
|
400
|
+
console.error(`${REFUSED}: ${error.message}`);
|
|
401
|
+
} else {
|
|
402
|
+
const owner = {
|
|
403
|
+
github: undefined,
|
|
404
|
+
linear: "lisa-linear-access",
|
|
405
|
+
jira: "lisa-atlassian-access",
|
|
406
|
+
}[tracker];
|
|
407
|
+
const diagnostic = failure(
|
|
408
|
+
error instanceof AccessFailure ? error.code : "config-invalid",
|
|
409
|
+
{
|
|
410
|
+
cfg,
|
|
411
|
+
name:
|
|
412
|
+
{
|
|
413
|
+
linear: "LINEAR_API_KEY",
|
|
414
|
+
jira: "ATLASSIAN_API_TOKEN",
|
|
415
|
+
}[tracker] ?? "GH_TOKEN",
|
|
416
|
+
...(owner ? { owner } : { tool: "gh" }),
|
|
417
|
+
}
|
|
418
|
+
);
|
|
419
|
+
console.error(`${diagnostic.code}: ${diagnostic.action}`);
|
|
420
|
+
}
|
|
421
|
+
process.exitCode = 2;
|
|
422
|
+
}
|
|
423
|
+
}
|
package/plugins/lisa/.codex-plugin/skills/lisa-secrets-access/scripts/task-tracker-intake.mjs
CHANGED
|
@@ -235,6 +235,42 @@ function response(raw) {
|
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
+
/**
|
|
239
|
+
* One GraphQL request through the Linear owner's adapter, identity-matched to
|
|
240
|
+
* the configured workspace and team. The key never enters this process's argv.
|
|
241
|
+
* @param {object} cfg Task configuration.
|
|
242
|
+
* @param {string} query GraphQL document.
|
|
243
|
+
* @param {object} variables GraphQL variables.
|
|
244
|
+
* @returns {object} The parsed response body.
|
|
245
|
+
*/
|
|
246
|
+
export function linearRequest(cfg, query, variables) {
|
|
247
|
+
const { workspace, teamKey } = cfg.effective.linear ?? {};
|
|
248
|
+
if (
|
|
249
|
+
typeof workspace !== "string" ||
|
|
250
|
+
!/^[A-Za-z0-9-]+$/u.test(workspace) ||
|
|
251
|
+
typeof teamKey !== "string" ||
|
|
252
|
+
!/^[A-Z][A-Z0-9]*$/u.test(teamKey)
|
|
253
|
+
)
|
|
254
|
+
throw new AccessFailure("config-invalid");
|
|
255
|
+
const raw = transportFor(cfg)(
|
|
256
|
+
"bash",
|
|
257
|
+
[
|
|
258
|
+
linearAdapter,
|
|
259
|
+
"--workspace",
|
|
260
|
+
workspace,
|
|
261
|
+
"--team-key",
|
|
262
|
+
teamKey,
|
|
263
|
+
"--query-file",
|
|
264
|
+
"-",
|
|
265
|
+
"--variables",
|
|
266
|
+
JSON.stringify(variables),
|
|
267
|
+
],
|
|
268
|
+
query,
|
|
269
|
+
{ 3: "credential-missing", 4: "identity-mismatch" }
|
|
270
|
+
);
|
|
271
|
+
return response(raw);
|
|
272
|
+
}
|
|
273
|
+
|
|
238
274
|
function readLinear(cfg, { ref, project, operation }) {
|
|
239
275
|
const workspace = cfg.effective.linear.workspace;
|
|
240
276
|
if (typeof workspace !== "string" || !/^[A-Za-z0-9-]+$/u.test(workspace))
|
|
@@ -282,18 +318,21 @@ function readLinear(cfg, { ref, project, operation }) {
|
|
|
282
318
|
throw new AccessFailure("capability-unreachable");
|
|
283
319
|
}
|
|
284
320
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
321
|
+
/**
|
|
322
|
+
* The configured Jira REST client, identity-matched against `/myself`.
|
|
323
|
+
* @param {object} cfg Task configuration.
|
|
324
|
+
* @returns {{call: Function} | {unavailable: string}} A client, or why the
|
|
325
|
+
* API token path is unavailable (`config-invalid` or a credential code).
|
|
326
|
+
*/
|
|
327
|
+
export function jiraApi(cfg) {
|
|
328
|
+
const { cloudId, email } = cfg.effective.atlassian ?? {};
|
|
288
329
|
if (
|
|
289
330
|
typeof cloudId !== "string" ||
|
|
290
331
|
!/^[A-Za-z0-9-]+$/u.test(cloudId) ||
|
|
291
332
|
typeof email !== "string" ||
|
|
292
333
|
!/^[^\s:@]+@[^\s:@]+$/u.test(email)
|
|
293
|
-
)
|
|
294
|
-
|
|
295
|
-
throw new AccessFailure("config-invalid");
|
|
296
|
-
}
|
|
334
|
+
)
|
|
335
|
+
return { unavailable: "config-invalid" };
|
|
297
336
|
const key = `ATLASSIAN_API_TOKEN_${email.toLowerCase().replaceAll(/[.@]/gu, "_")}`;
|
|
298
337
|
const env = process.env.ATLASSIAN_API_TOKEN?.trim()
|
|
299
338
|
? process.env
|
|
@@ -302,16 +341,14 @@ function readJira(cfg, request) {
|
|
|
302
341
|
ATLASSIAN_API_TOKEN: process.env[key],
|
|
303
342
|
};
|
|
304
343
|
const credential = jiraCredential(cfg, env);
|
|
305
|
-
if (!credential.available) {
|
|
306
|
-
if (!site) throw new AccessFailure(credential.code);
|
|
307
|
-
return readJiraWithAcli(cfg, request);
|
|
308
|
-
}
|
|
344
|
+
if (!credential.available) return { unavailable: credential.code };
|
|
309
345
|
const encoded = Buffer.from(`${email}:${credential.value}`).toString(
|
|
310
346
|
"base64"
|
|
311
347
|
);
|
|
312
348
|
const base = `https://api.atlassian.com/ex/jira/${cloudId}/rest/api/3`;
|
|
313
349
|
const transport = transportFor(cfg);
|
|
314
|
-
|
|
350
|
+
// A payload is not secret, so it travels in argv; the credential never does.
|
|
351
|
+
const call = (endpoint, method = "GET", payload) => {
|
|
315
352
|
const raw = transport(
|
|
316
353
|
"curl",
|
|
317
354
|
[
|
|
@@ -325,16 +362,37 @@ function readJira(cfg, request) {
|
|
|
325
362
|
"@-",
|
|
326
363
|
"--header",
|
|
327
364
|
"Accept: application/json",
|
|
365
|
+
...(method === "GET"
|
|
366
|
+
? []
|
|
367
|
+
: [
|
|
368
|
+
"--request",
|
|
369
|
+
method,
|
|
370
|
+
"--header",
|
|
371
|
+
"Content-Type: application/json",
|
|
372
|
+
"--data-binary",
|
|
373
|
+
JSON.stringify(payload),
|
|
374
|
+
]),
|
|
328
375
|
`${base}${endpoint}`,
|
|
329
376
|
],
|
|
330
377
|
`Authorization: Basic ${encoded}\n`
|
|
331
378
|
);
|
|
332
379
|
if (raw.includes(credential.value) || raw.includes(encoded))
|
|
333
380
|
throw new AccessFailure("capability-unreachable");
|
|
334
|
-
return response(raw);
|
|
381
|
+
return raw.trim() === "" ? null : response(raw);
|
|
335
382
|
};
|
|
336
|
-
if (
|
|
383
|
+
if (call("/myself")?.emailAddress?.toLowerCase() !== email.toLowerCase())
|
|
337
384
|
throw new AccessFailure("identity-mismatch");
|
|
385
|
+
return { call };
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
function readJira(cfg, request) {
|
|
389
|
+
const { ref, project, operation } = request;
|
|
390
|
+
const api = jiraApi(cfg);
|
|
391
|
+
if (api.unavailable) {
|
|
392
|
+
if (cfg.effective.atlassian?.site) return readJiraWithAcli(cfg, request);
|
|
393
|
+
throw new AccessFailure(api.unavailable);
|
|
394
|
+
}
|
|
395
|
+
const get = api.call;
|
|
338
396
|
const endpoint = `/issue/${ref}`;
|
|
339
397
|
const issue = get(`${endpoint}?fields=*all`);
|
|
340
398
|
if (issue?.key !== ref || issue.fields?.project?.key !== project)
|
|
@@ -150,6 +150,16 @@ export function unboundWrite(input, cfg) {
|
|
|
150
150
|
);
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
+
/**
|
|
154
|
+
* This installation's prepare/read owner script as one shell word.
|
|
155
|
+
* @returns {string} The path, quoted only when it needs to be.
|
|
156
|
+
*/
|
|
157
|
+
function ownerWord() {
|
|
158
|
+
return /^[\w./@+-]+$/.test(owner)
|
|
159
|
+
? owner
|
|
160
|
+
: `'${owner.replaceAll("'", "'\\''")}'`;
|
|
161
|
+
}
|
|
162
|
+
|
|
153
163
|
/**
|
|
154
164
|
* The exact read command this installation admits with no work item bound.
|
|
155
165
|
* @param {Record<string, any>} cfg Task configuration.
|
|
@@ -157,9 +167,7 @@ export function unboundWrite(input, cfg) {
|
|
|
157
167
|
*/
|
|
158
168
|
function readCommand(cfg) {
|
|
159
169
|
const c = cfg.effective ?? {};
|
|
160
|
-
const script =
|
|
161
|
-
? owner
|
|
162
|
-
: `'${owner.replaceAll("'", "'\\''")}'`;
|
|
170
|
+
const script = ownerWord();
|
|
163
171
|
if (c.tracker === "linear" && c.linear?.teamKey)
|
|
164
172
|
return `node ${script} --tracker-intake-read --ref ${c.linear.teamKey}-<number> --read issue`;
|
|
165
173
|
if (c.tracker === "jira" && c.jira?.project)
|
|
@@ -192,6 +200,8 @@ export function unboundRefusal(cfg) {
|
|
|
192
200
|
: "",
|
|
193
201
|
"A file written outside every git repository, such as a scratch or memory file, is allowed.",
|
|
194
202
|
"To change anything in this project, bind its ticket first with lisa-track.",
|
|
203
|
+
`Its prepare step needs no shell input: write the prepare JSON to a file outside every repository, then run exactly: node ${ownerWord()} --prepare --ref <ticket> --input-file <absolute path of that file>.`,
|
|
204
|
+
`If the work has no ticket yet, file one the same way: write {"title", "body", "labels", "readiness"} to a file outside every repository, then run exactly: node ${ownerWord()} --tracker-create --input-file <absolute path of that file>.`,
|
|
195
205
|
]
|
|
196
206
|
.filter(Boolean)
|
|
197
207
|
.join(" "),
|
|
@@ -43,6 +43,8 @@ See the `config-resolution` rule for the full configuration schema and skill-map
|
|
|
43
43
|
- **3b (github):** Invoke `lisa-github-write-issue` via the Skill tool, passing `$ARGUMENTS` verbatim.
|
|
44
44
|
- **3c (linear):** Invoke `lisa-linear-write-issue` via the Skill tool, passing `$ARGUMENTS` verbatim.
|
|
45
45
|
|
|
46
|
+
**No ticket bound yet.** In a project with `.lisa.config.json`, the readiness guard refuses every tracker write until a ticket is bound, so the vendor writer cannot run its own create command. For a CREATE in that state, the vendor writer still drafts and validates the item, then files it through the one admitted command instead: write `{"title", "body", "labels", "readiness"}` (`readiness`: `build-ready`, `human-gate` or `container`; Jira also takes `issue_type`) to a file outside every git repository and run exactly `node <owner>/preflight-secrets.mjs --tracker-create --input-file <absolute path>`, where `<owner>` is the path the guard's `work-item-unbound` refusal names. It prints `{"code":"tracker-created","ref","url"}`; continue with that ref (verify, claim, prepare and bind). See `tool-access-gate`.
|
|
47
|
+
|
|
46
48
|
4. **Surface the vendor skill's output unchanged.** Do not paraphrase; downstream callers parse the structured response.
|
|
47
49
|
|
|
48
50
|
## Rules
|
|
@@ -76,7 +76,7 @@ try {
|
|
|
76
76
|
} else if (result.status !== 0) {
|
|
77
77
|
// Only the fixed owner result is published. Environment errors never echo.
|
|
78
78
|
const safe =
|
|
79
|
-
/^(?:credential-missing|provider-unreachable|capability-unreachable|bootstrap-missing|tool-missing|config-invalid|config-unreadable|config-undiscovered|config-unknown|identity-mismatch|adapter-unsupported|requirements-stale|requirements-prepared|native-proof-needed|native-response-unrepresented): [^\n]*\n?$/.test(
|
|
79
|
+
/^(?:credential-missing|provider-unreachable|capability-unreachable|bootstrap-missing|tool-missing|config-invalid|config-unreadable|config-undiscovered|config-unknown|identity-mismatch|adapter-unsupported|requirements-stale|work-item-unbound|requirements-prepared|native-proof-needed|native-response-unrepresented): [^\n]*\n?$/.test(
|
|
80
80
|
result.stderr ?? ""
|
|
81
81
|
);
|
|
82
82
|
console.error(
|
|
@@ -23,11 +23,29 @@ the resolver or read its inputs.
|
|
|
23
23
|
|
|
24
24
|
Supply a complete values-free `required_access` array and
|
|
25
25
|
`requirements_complete: true` as JSON on stdin to the owner's
|
|
26
|
-
`--prepare --ref <canonical-ref>` mode.
|
|
26
|
+
`--prepare --ref <canonical-ref>` mode. An agent's shell tool has no stdin:
|
|
27
|
+
write the same JSON to a file outside every git repository (such a write is
|
|
28
|
+
admitted with no ticket bound) and run exactly
|
|
29
|
+
`node <owner>/preflight-secrets.mjs --prepare --ref <canonical-ref> --input-file <absolute path>`.
|
|
30
|
+
The path is one plain word; nothing may follow it. For the first context, include the complete
|
|
27
31
|
unedited `context_body` on that same stdin; it creates
|
|
28
32
|
only the fixed ignored0600 context after Git-ignore and EAS checks. Existing
|
|
29
33
|
context cannot be replaced through `context_body`. This is the bounded initial
|
|
30
34
|
resolver metadata transaction, not a general Write or shell exception.
|
|
35
|
+
|
|
36
|
+
With no ticket bound, the same owner files the ticket the work needs. Write
|
|
37
|
+
`{"title", "body", "labels", "readiness", "issue_type"}` (labels and
|
|
38
|
+
issue_type optional) to a file outside every git repository and run exactly
|
|
39
|
+
`node <owner>/preflight-secrets.mjs --tracker-create --input-file <absolute path>`.
|
|
40
|
+
`readiness` is `build-ready`, `human-gate` or `container`, and the body must
|
|
41
|
+
agree with it: a `human-gate` body declares the `[lisa-human-gate]` hold, and a
|
|
42
|
+
`container` body carries `None — container: state rolls up from children` and
|
|
43
|
+
no leaf type. Anything else is refused with `tracker-create-refused` and nothing
|
|
44
|
+
is filed. The owner files only into the configured repository, team or project;
|
|
45
|
+
for `build-ready` it applies the configured ready label or state itself. It
|
|
46
|
+
prints `{"code":"tracker-created","ref","url"}`. It is the transport only: the
|
|
47
|
+
writer's validation gates still run before it, and every other tracker write
|
|
48
|
+
stays refused until a ticket is bound.
|
|
31
49
|
For the native Claude `Write` tool, pass the complete canonical context as
|
|
32
50
|
`{file_path: "<absolute project root>/.lisa/work-item-context.md", content: "<leading requirements header plus full body>"}`.
|
|
33
51
|
Use the header schema above with current root/ref/config/surface/body/requirements
|
|
@@ -92,7 +110,8 @@ reflect requirement identifiers/resources/paths, parse errors or provider output
|
|
|
92
110
|
Do not block unrelated tasks or require optional integrations universally.
|
|
93
111
|
|
|
94
112
|
The exact readiness owner command (`node <owner>/preflight-secrets.mjs --task
|
|
95
|
-
--ref <canonical-ref>`, or `--prepare` with that ref and JSON on terminal stdin
|
|
113
|
+
--ref <canonical-ref>`, or `--prepare` with that ref and JSON on terminal stdin
|
|
114
|
+
or in an `--input-file` outside every repository)
|
|
96
115
|
remains available during refusal. It grants no work: task mode still reports its
|
|
97
116
|
real verdict, and preparation only refreshes the ignored requirements metadata.
|
|
98
117
|
Only the exact native context Write/Add File forms above carry private metadata.
|
|
@@ -10,10 +10,13 @@ In a project with `.lisa.config.json`, the task-readiness guard enforces this. W
|
|
|
10
10
|
|
|
11
11
|
- the Read, Grep and Glob tools;
|
|
12
12
|
- the fixed ticket read commands. The refusal names the exact one for that installation: `preflight-secrets.mjs --tracker-intake-read --ref <KEY> --read issue|comments` for Linear and Jira, `gh issue view <n> --repo <org>/<repo> --json …` for GitHub;
|
|
13
|
-
- a write that lands in no git repository, such as a scratch or memory file
|
|
13
|
+
- a write that lands in no git repository, such as a scratch or memory file;
|
|
14
|
+
- filing the ticket the work needs: `preflight-secrets.mjs --tracker-create --input-file <absolute path>`, which files into the configured tracker only and refuses a filing with no readiness declaration (see `tool-access-gate`).
|
|
14
15
|
|
|
15
16
|
Answering a question about a ticket needs none of this. Never bind a ticket just to read one.
|
|
16
17
|
|
|
18
|
+
To start work on an existing ticket from an unbound session, prepare it first, then bind it. Write the prepare JSON to a file outside every repository, then run the admitted `preflight-secrets.mjs --prepare --ref <ticket> --input-file <absolute path>` (see `tool-access-gate`). Once the ticket is prepared, the guard decides by that ticket's readiness, and `lisa-work-item.mjs link`, the claim and the work run normally.
|
|
19
|
+
|
|
17
20
|
## Resolve, claim, bind
|
|
18
21
|
|
|
19
22
|
Use `lisa-track` as the single entry point:
|