@amistio/cli 0.1.0 → 0.1.2
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 +2 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.js +3493 -642
- package/dist/index.js.map +7 -1
- package/package.json +9 -6
- package/dist/api-client.d.ts +0 -175
- package/dist/api-client.d.ts.map +0 -1
- package/dist/api-client.js +0 -116
- package/dist/api-client.js.map +0 -1
- package/dist/bootstrap.d.ts +0 -11
- package/dist/bootstrap.d.ts.map +0 -1
- package/dist/bootstrap.js +0 -66
- package/dist/bootstrap.js.map +0 -1
- package/dist/control-plane.d.ts +0 -11
- package/dist/control-plane.d.ts.map +0 -1
- package/dist/control-plane.js +0 -91
- package/dist/control-plane.js.map +0 -1
- package/dist/credential-store.d.ts +0 -9
- package/dist/credential-store.d.ts.map +0 -1
- package/dist/credential-store.js +0 -32
- package/dist/credential-store.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/local-tool-runner.d.ts +0 -93
- package/dist/local-tool-runner.d.ts.map +0 -1
- package/dist/local-tool-runner.js +0 -472
- package/dist/local-tool-runner.js.map +0 -1
- package/dist/orchestrator.d.ts +0 -7
- package/dist/orchestrator.d.ts.map +0 -1
- package/dist/orchestrator.js +0 -61
- package/dist/orchestrator.js.map +0 -1
- package/dist/session-policy.d.ts +0 -20
- package/dist/session-policy.d.ts.map +0 -1
- package/dist/session-policy.js +0 -125
- package/dist/session-policy.js.map +0 -1
- package/dist/sync.d.ts +0 -33
- package/dist/sync.d.ts.map +0 -1
- package/dist/sync.js +0 -279
- package/dist/sync.js.map +0 -1
- package/dist/tool-session-store.d.ts +0 -8
- package/dist/tool-session-store.d.ts.map +0 -1
- package/dist/tool-session-store.js +0 -38
- package/dist/tool-session-store.js.map +0 -1
- package/dist/work-runner.d.ts +0 -4
- package/dist/work-runner.d.ts.map +0 -1
- package/dist/work-runner.js +0 -100
- package/dist/work-runner.js.map +0 -1
package/dist/work-runner.js
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { brainGenerationResultSchema } from "@amistio/shared";
|
|
2
|
-
const generationResultStart = "AMISTIO_BRAIN_GENERATION_RESULT_START";
|
|
3
|
-
const generationResultEnd = "AMISTIO_BRAIN_GENERATION_RESULT_END";
|
|
4
|
-
export function createWorkExecutionPrompt(workItem) {
|
|
5
|
-
if (workItem.workKind === "brainGeneration") {
|
|
6
|
-
return createBrainGenerationPrompt(workItem);
|
|
7
|
-
}
|
|
8
|
-
return [
|
|
9
|
-
"# Amistio Work Execution",
|
|
10
|
-
"",
|
|
11
|
-
"You are running locally through the Amistio CLI inside the user's repository.",
|
|
12
|
-
"Execute the approved work item below using the repository's existing orchestration files, instructions, and constraints.",
|
|
13
|
-
"",
|
|
14
|
-
"## Work Item",
|
|
15
|
-
"",
|
|
16
|
-
`Title: ${workItem.title}`,
|
|
17
|
-
`Work item ID: ${workItem.workItemId}`,
|
|
18
|
-
`Project ID: ${workItem.projectId}`,
|
|
19
|
-
"",
|
|
20
|
-
"## Rules",
|
|
21
|
-
"",
|
|
22
|
-
"- Read AGENTS.md first when it exists.",
|
|
23
|
-
"- Read the relevant root control-plane files before implementation so the work stays aligned with existing direction.",
|
|
24
|
-
"- Keep changes focused on this work item.",
|
|
25
|
-
"- Preserve old decisions, plans, memory, and prompts unless the work item explicitly supersedes them.",
|
|
26
|
-
"- Do not commit changes.",
|
|
27
|
-
"- Do not write secrets into the repository.",
|
|
28
|
-
"- Do not create a repo-local .amistio folder.",
|
|
29
|
-
"- Run relevant verification commands when feasible and summarize results."
|
|
30
|
-
].join("\n");
|
|
31
|
-
}
|
|
32
|
-
export function parseBrainGenerationArtifacts(output) {
|
|
33
|
-
const start = output.indexOf(generationResultStart);
|
|
34
|
-
const end = output.indexOf(generationResultEnd, start + generationResultStart.length);
|
|
35
|
-
if (start === -1 || end === -1 || end <= start) {
|
|
36
|
-
throw new Error("Local AI generation did not return an Amistio brain generation result block.");
|
|
37
|
-
}
|
|
38
|
-
const payload = output.slice(start + generationResultStart.length, end).trim();
|
|
39
|
-
const parsed = JSON.parse(stripJsonFence(payload));
|
|
40
|
-
return brainGenerationResultSchema.parse(parsed).artifacts;
|
|
41
|
-
}
|
|
42
|
-
function createBrainGenerationPrompt(workItem) {
|
|
43
|
-
const wish = workItem.sourceWish ?? workItem.title;
|
|
44
|
-
return [
|
|
45
|
-
"# Amistio Brain Generation",
|
|
46
|
-
"",
|
|
47
|
-
"You are running locally through the Amistio CLI inside the user's repository.",
|
|
48
|
-
"Generate reviewable project-brain artifacts from the submitted wish. Do not implement product/source code changes in this pass.",
|
|
49
|
-
"",
|
|
50
|
-
"## Submitted Wish",
|
|
51
|
-
"",
|
|
52
|
-
wish,
|
|
53
|
-
"",
|
|
54
|
-
"## Work Item",
|
|
55
|
-
"",
|
|
56
|
-
`Title: ${workItem.title}`,
|
|
57
|
-
`Work item ID: ${workItem.workItemId}`,
|
|
58
|
-
`Project ID: ${workItem.projectId}`,
|
|
59
|
-
`Generated draft ID: ${workItem.generatedDraftId ?? "unknown"}`,
|
|
60
|
-
"",
|
|
61
|
-
"## Read First",
|
|
62
|
-
"",
|
|
63
|
-
"- Read AGENTS.md first when it exists.",
|
|
64
|
-
"- Read relevant files under architecture/, context/, decisions/, features/, memory/, plans/, prompts/, and workflows/ before drafting.",
|
|
65
|
-
"- Keep source code and secrets local. Do not include source-code payloads, access tokens, API keys, local credential paths, or provider session references in the result.",
|
|
66
|
-
"",
|
|
67
|
-
"## Generate Artifacts",
|
|
68
|
-
"",
|
|
69
|
-
"Return Markdown artifacts that should enter human review before implementation. Use only these document types and matching repo roots:",
|
|
70
|
-
"",
|
|
71
|
-
"- architecture -> architecture/",
|
|
72
|
-
"- context -> context/",
|
|
73
|
-
"- decision -> decisions/",
|
|
74
|
-
"- feature -> features/",
|
|
75
|
-
"- memory -> memory/",
|
|
76
|
-
"- plan -> plans/",
|
|
77
|
-
"- prompt -> prompts/",
|
|
78
|
-
"- workflow -> workflows/",
|
|
79
|
-
"",
|
|
80
|
-
"Each artifact needs documentType, title, repoPath, and content. Include at least a plan and an implementation prompt when implementation work is implied. Use model-agnostic prompt wording.",
|
|
81
|
-
"",
|
|
82
|
-
"## Output Contract",
|
|
83
|
-
"",
|
|
84
|
-
"Print exactly one JSON object between the markers below. The CLI will submit only this structured result back to Amistio.",
|
|
85
|
-
"",
|
|
86
|
-
generationResultStart,
|
|
87
|
-
'{"artifacts":[{"documentType":"plan","title":"Plan: Example","repoPath":"plans/PLAN-example.md","content":"# Plan: Example\\n\\n## Goal\\n..."}]}',
|
|
88
|
-
generationResultEnd,
|
|
89
|
-
"",
|
|
90
|
-
"Do not put Markdown fences around the markers. Do not claim implementation is complete."
|
|
91
|
-
].join("\n");
|
|
92
|
-
}
|
|
93
|
-
function stripJsonFence(value) {
|
|
94
|
-
const trimmed = value.trim();
|
|
95
|
-
if (!trimmed.startsWith("```")) {
|
|
96
|
-
return trimmed;
|
|
97
|
-
}
|
|
98
|
-
return trimmed.replace(/^```(?:json)?\s*/i, "").replace(/```$/i, "").trim();
|
|
99
|
-
}
|
|
100
|
-
//# sourceMappingURL=work-runner.js.map
|
package/dist/work-runner.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"work-runner.js","sourceRoot":"","sources":["../src/work-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAA8C,MAAM,iBAAiB,CAAC;AAE1G,MAAM,qBAAqB,GAAG,uCAAuC,CAAC;AACtE,MAAM,mBAAmB,GAAG,qCAAqC,CAAC;AAElE,MAAM,UAAU,yBAAyB,CAAC,QAAkB;IACxD,IAAI,QAAQ,CAAC,QAAQ,KAAK,iBAAiB,EAAE,CAAC;QAC1C,OAAO,2BAA2B,CAAC,QAAQ,CAAC,CAAC;IACjD,CAAC;IAED,OAAO;QACH,0BAA0B;QAC1B,EAAE;QACF,+EAA+E;QAC/E,0HAA0H;QAC1H,EAAE;QACF,cAAc;Q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