@codsy/cli 0.0.0-stage → 1.0.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/LICENSE +201 -0
- package/README.md +227 -2
- package/dist/check-screen-OZJD7UHU.js +80 -0
- package/dist/chunk-46NW6PYM.js +115 -0
- package/dist/chunk-52CMOWJF.js +59 -0
- package/dist/chunk-6AVERKMZ.js +17 -0
- package/dist/chunk-BJYMGFW2.js +14 -0
- package/dist/chunk-FVNSMO6G.js +313 -0
- package/dist/chunk-JVEULAOD.js +24 -0
- package/dist/chunk-KFHC377Y.js +21 -0
- package/dist/chunk-MOIYJ6UU.js +48 -0
- package/dist/chunk-TDOJ55BG.js +120 -0
- package/dist/chunk-UWXPACZ7.js +54 -0
- package/dist/cli.d.ts +5 -0
- package/dist/cli.js +2032 -0
- package/dist/home-screen-UIUS4UOT.js +206 -0
- package/dist/init-wizard-MXAFTYCQ.js +54 -0
- package/dist/new-schema-wizard-NYIHF47J.js +123 -0
- package/dist/new-skill-wizard-AZJ5DLDM.js +121 -0
- package/package.json +66 -4
- package/templates/blank/.github/PULL_REQUEST_TEMPLATE.md +7 -0
- package/templates/blank/.github/workflows/codsy.yml +33 -0
- package/templates/blank/AGENTS.md +8 -0
- package/templates/blank/CODEOWNERS +4 -0
- package/templates/blank/README.md +12 -0
- package/templates/blank/codsy.config.yaml +1 -0
- package/templates/blank/context/company.md +4 -0
- package/templates/blank/context/customers.md +4 -0
- package/templates/blank/context/industry.md +4 -0
- package/templates/blank/context/operations.md +4 -0
- package/templates/blank/context/products.md +4 -0
- package/templates/blank/context/strategy.md +4 -0
- package/templates/blank/evals/.gitkeep +0 -0
- package/templates/blank/schemas/.gitkeep +0 -0
- package/templates/blank/skills/.gitkeep +0 -0
- package/templates/finance/.github/PULL_REQUEST_TEMPLATE.md +8 -0
- package/templates/finance/.github/workflows/codsy.yml +33 -0
- package/templates/finance/AGENTS.md +14 -0
- package/templates/finance/CODEOWNERS +4 -0
- package/templates/finance/README.md +16 -0
- package/templates/finance/codsy.config.yaml +1 -0
- package/templates/finance/context/company.md +6 -0
- package/templates/finance/context/customers.md +5 -0
- package/templates/finance/context/industry.md +5 -0
- package/templates/finance/context/operations.md +6 -0
- package/templates/finance/context/products.md +4 -0
- package/templates/finance/context/strategy.md +4 -0
- package/templates/finance/evals/collections-classification/cases.yaml +81 -0
- package/templates/finance/schemas/account.schema.json +21 -0
- package/templates/finance/skills/collections-classification/SKILL.md +49 -0
- package/templates/sales/.github/PULL_REQUEST_TEMPLATE.md +7 -0
- package/templates/sales/.github/workflows/codsy.yml +33 -0
- package/templates/sales/AGENTS.md +11 -0
- package/templates/sales/CODEOWNERS +4 -0
- package/templates/sales/README.md +13 -0
- package/templates/sales/codsy.config.yaml +1 -0
- package/templates/sales/context/company.md +6 -0
- package/templates/sales/context/customers.md +5 -0
- package/templates/sales/context/industry.md +5 -0
- package/templates/sales/context/operations.md +5 -0
- package/templates/sales/context/products.md +4 -0
- package/templates/sales/context/strategy.md +4 -0
- package/templates/sales/evals/lead-qualification/cases.yaml +87 -0
- package/templates/sales/schemas/lead.schema.json +26 -0
- package/templates/sales/skills/lead-qualification/SKILL.md +46 -0
- package/templates/support/.github/PULL_REQUEST_TEMPLATE.md +7 -0
- package/templates/support/.github/workflows/codsy.yml +33 -0
- package/templates/support/AGENTS.md +11 -0
- package/templates/support/CODEOWNERS +4 -0
- package/templates/support/README.md +13 -0
- package/templates/support/codsy.config.yaml +1 -0
- package/templates/support/context/company.md +5 -0
- package/templates/support/context/customers.md +5 -0
- package/templates/support/context/industry.md +5 -0
- package/templates/support/context/operations.md +5 -0
- package/templates/support/context/products.md +4 -0
- package/templates/support/context/strategy.md +4 -0
- package/templates/support/evals/ticket-triage/cases.yaml +81 -0
- package/templates/support/schemas/ticket.schema.json +22 -0
- package/templates/support/skills/ticket-triage/SKILL.md +46 -0
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import {
|
|
2
|
+
HOME_MENU_ITEMS,
|
|
3
|
+
statusLine
|
|
4
|
+
} from "./chunk-FVNSMO6G.js";
|
|
5
|
+
import {
|
|
6
|
+
SelectList
|
|
7
|
+
} from "./chunk-MOIYJ6UU.js";
|
|
8
|
+
import {
|
|
9
|
+
BASE_GRID,
|
|
10
|
+
detectCapabilitiesFromProcess,
|
|
11
|
+
renderGridLines
|
|
12
|
+
} from "./chunk-46NW6PYM.js";
|
|
13
|
+
import "./chunk-6AVERKMZ.js";
|
|
14
|
+
import {
|
|
15
|
+
THEME
|
|
16
|
+
} from "./chunk-BJYMGFW2.js";
|
|
17
|
+
|
|
18
|
+
// src/ui/home-screen.tsx
|
|
19
|
+
import { Box as Box2, render, Text as Text2 } from "ink";
|
|
20
|
+
|
|
21
|
+
// src/ui/components/IdleMascot.tsx
|
|
22
|
+
import { useEffect, useState } from "react";
|
|
23
|
+
import { Box, Text } from "ink";
|
|
24
|
+
|
|
25
|
+
// src/ui/mascot/animations.ts
|
|
26
|
+
function applyDiffs(grid, diffs) {
|
|
27
|
+
const rows = grid.map((row) => row.split(""));
|
|
28
|
+
for (const diff of diffs) {
|
|
29
|
+
const row = rows[diff.row];
|
|
30
|
+
if (!row || diff.col >= row.length) continue;
|
|
31
|
+
row[diff.col] = diff.filled ? "#" : ".";
|
|
32
|
+
}
|
|
33
|
+
return rows.map((row) => row.join(""));
|
|
34
|
+
}
|
|
35
|
+
var ANIMATIONS = {
|
|
36
|
+
idle: {
|
|
37
|
+
name: "idle",
|
|
38
|
+
frames: [
|
|
39
|
+
{ diffs: [] },
|
|
40
|
+
{ diffs: [{ row: 2, col: 13, filled: false }] },
|
|
41
|
+
{ diffs: [{ row: 0, col: 14, filled: false }] },
|
|
42
|
+
{ diffs: [] }
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
walk: {
|
|
46
|
+
name: "walk",
|
|
47
|
+
frames: [
|
|
48
|
+
{ diffs: [] },
|
|
49
|
+
{
|
|
50
|
+
diffs: [
|
|
51
|
+
{ row: 14, col: 2, filled: false },
|
|
52
|
+
{ row: 14, col: 3, filled: false },
|
|
53
|
+
{ row: 14, col: 4, filled: false },
|
|
54
|
+
{ row: 14, col: 6, filled: true },
|
|
55
|
+
{ row: 14, col: 7, filled: true }
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
peck: {
|
|
61
|
+
name: "peck",
|
|
62
|
+
frames: [
|
|
63
|
+
{ diffs: [] },
|
|
64
|
+
{
|
|
65
|
+
diffs: [
|
|
66
|
+
{ row: 0, col: 14, filled: false },
|
|
67
|
+
{ row: 1, col: 12, filled: false },
|
|
68
|
+
{ row: 1, col: 15, filled: false }
|
|
69
|
+
]
|
|
70
|
+
},
|
|
71
|
+
{ diffs: [] }
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
alert: {
|
|
75
|
+
name: "alert",
|
|
76
|
+
frames: [{ diffs: [] }, { diffs: [{ row: 0, col: 13, filled: true }] }]
|
|
77
|
+
},
|
|
78
|
+
celebrate: {
|
|
79
|
+
name: "celebrate",
|
|
80
|
+
frames: [
|
|
81
|
+
{ diffs: [] },
|
|
82
|
+
{
|
|
83
|
+
diffs: [
|
|
84
|
+
{ row: 18, col: 7, filled: false },
|
|
85
|
+
{ row: 18, col: 8, filled: false },
|
|
86
|
+
{ row: 18, col: 9, filled: false },
|
|
87
|
+
{ row: 18, col: 13, filled: false },
|
|
88
|
+
{ row: 18, col: 14, filled: false },
|
|
89
|
+
{ row: 18, col: 15, filled: false }
|
|
90
|
+
]
|
|
91
|
+
},
|
|
92
|
+
{ diffs: [] }
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
think: {
|
|
96
|
+
name: "think",
|
|
97
|
+
frames: [
|
|
98
|
+
{ diffs: [] },
|
|
99
|
+
{
|
|
100
|
+
diffs: [
|
|
101
|
+
{ row: 1, col: 15, filled: false },
|
|
102
|
+
{ row: 1, col: 17, filled: true }
|
|
103
|
+
]
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
diffs: [
|
|
107
|
+
{ row: 1, col: 15, filled: false },
|
|
108
|
+
{ row: 2, col: 17, filled: true }
|
|
109
|
+
]
|
|
110
|
+
},
|
|
111
|
+
{ diffs: [] }
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
function getFramesFor(grid, animation) {
|
|
116
|
+
return animation.frames.map((frame) => applyDiffs(grid, frame.diffs));
|
|
117
|
+
}
|
|
118
|
+
function getAnimationFrames(grid, animationName) {
|
|
119
|
+
return getFramesFor(grid, ANIMATIONS[animationName]);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// src/ui/components/IdleMascot.tsx
|
|
123
|
+
import { jsx } from "react/jsx-runtime";
|
|
124
|
+
var IDLE_FRAME_MS = 500;
|
|
125
|
+
var IDLE_FRAMES = getAnimationFrames(BASE_GRID, "idle");
|
|
126
|
+
function IdleMascot({ motionEnabled }) {
|
|
127
|
+
const [index, setIndex] = useState(0);
|
|
128
|
+
useEffect(() => {
|
|
129
|
+
if (!motionEnabled) return;
|
|
130
|
+
const timer = setTimeout(() => {
|
|
131
|
+
setIndex((current) => (current + 1) % IDLE_FRAMES.length);
|
|
132
|
+
}, IDLE_FRAME_MS);
|
|
133
|
+
return () => clearTimeout(timer);
|
|
134
|
+
}, [index, motionEnabled]);
|
|
135
|
+
const lines = renderGridLines(IDLE_FRAMES[index] ?? BASE_GRID, "none");
|
|
136
|
+
return /* @__PURE__ */ jsx(Box, { flexDirection: "column", children: lines.map((line, lineIndex) => /* @__PURE__ */ jsx(Text, { color: THEME.sand, children: line }, lineIndex)) });
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// src/ui/use-terminal-width.ts
|
|
140
|
+
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
141
|
+
var DEFAULT_WIDTH = 80;
|
|
142
|
+
function useTerminalWidth(stream = process.stdout) {
|
|
143
|
+
const [width, setWidth] = useState2(stream.columns ?? DEFAULT_WIDTH);
|
|
144
|
+
useEffect2(() => {
|
|
145
|
+
const handleResize = () => setWidth(stream.columns ?? DEFAULT_WIDTH);
|
|
146
|
+
stream.on("resize", handleResize);
|
|
147
|
+
return () => {
|
|
148
|
+
stream.off("resize", handleResize);
|
|
149
|
+
};
|
|
150
|
+
}, [stream]);
|
|
151
|
+
return width;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// src/ui/home-screen.tsx
|
|
155
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
156
|
+
var ONE_LINE_DESCRIPTION = "Codsy helps you write operational knowledge as versioned files people and AI agents can both read.";
|
|
157
|
+
var MASCOT_MIN_WIDTH = 60;
|
|
158
|
+
function Home({
|
|
159
|
+
status,
|
|
160
|
+
onSelect,
|
|
161
|
+
onCancel,
|
|
162
|
+
stream,
|
|
163
|
+
motionEnabled = true
|
|
164
|
+
}) {
|
|
165
|
+
const width = useTerminalWidth(stream);
|
|
166
|
+
const items = HOME_MENU_ITEMS.map((item) => ({ label: item.label, value: item.command }));
|
|
167
|
+
return /* @__PURE__ */ jsxs(Box2, { flexDirection: "column", children: [
|
|
168
|
+
width >= MASCOT_MIN_WIDTH && /* @__PURE__ */ jsx2(Box2, { marginBottom: 1, children: /* @__PURE__ */ jsx2(IdleMascot, { motionEnabled }) }),
|
|
169
|
+
/* @__PURE__ */ jsx2(Text2, { children: ONE_LINE_DESCRIPTION }),
|
|
170
|
+
status.inProject && /* @__PURE__ */ jsx2(Text2, { children: statusLine(status) }),
|
|
171
|
+
/* @__PURE__ */ jsx2(SelectList, { items, onSelect, onCancel })
|
|
172
|
+
] });
|
|
173
|
+
}
|
|
174
|
+
async function renderHomeScreen(status) {
|
|
175
|
+
const capabilities = detectCapabilitiesFromProcess({
|
|
176
|
+
plainFlag: false,
|
|
177
|
+
noMotionFlag: false,
|
|
178
|
+
format: void 0
|
|
179
|
+
});
|
|
180
|
+
return new Promise((resolve) => {
|
|
181
|
+
const instance = render(
|
|
182
|
+
/* @__PURE__ */ jsx2(
|
|
183
|
+
Home,
|
|
184
|
+
{
|
|
185
|
+
status,
|
|
186
|
+
motionEnabled: capabilities.motionEnabled,
|
|
187
|
+
onSelect: (command) => {
|
|
188
|
+
instance.unmount();
|
|
189
|
+
process.stdout.write(`Run: ${command}
|
|
190
|
+
`);
|
|
191
|
+
resolve();
|
|
192
|
+
},
|
|
193
|
+
onCancel: () => {
|
|
194
|
+
instance.unmount();
|
|
195
|
+
resolve();
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
)
|
|
199
|
+
);
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
export {
|
|
203
|
+
Home,
|
|
204
|
+
renderHomeScreen
|
|
205
|
+
};
|
|
206
|
+
//# sourceMappingURL=home-screen-UIUS4UOT.js.map
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SelectList
|
|
3
|
+
} from "./chunk-MOIYJ6UU.js";
|
|
4
|
+
import {
|
|
5
|
+
StepIndicator
|
|
6
|
+
} from "./chunk-KFHC377Y.js";
|
|
7
|
+
import {
|
|
8
|
+
KeyHintFooter
|
|
9
|
+
} from "./chunk-6AVERKMZ.js";
|
|
10
|
+
import "./chunk-BJYMGFW2.js";
|
|
11
|
+
|
|
12
|
+
// src/ui/init-wizard.tsx
|
|
13
|
+
import { Box, render, Text } from "ink";
|
|
14
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
+
var TEMPLATE_ITEMS = [
|
|
16
|
+
{ label: "Blank \u2014 start with no example skill", value: "blank" },
|
|
17
|
+
{ label: "Sales \u2014 lead qualification example", value: "sales" },
|
|
18
|
+
{ label: "Support \u2014 ticket triage example", value: "support" },
|
|
19
|
+
{ label: "Finance \u2014 collections classification example", value: "finance" }
|
|
20
|
+
];
|
|
21
|
+
function Wizard({ onDone }) {
|
|
22
|
+
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
|
|
23
|
+
/* @__PURE__ */ jsx(StepIndicator, { current: 1, total: 1, label: "Choose a starting point" }),
|
|
24
|
+
/* @__PURE__ */ jsx(Text, { children: "What kind of project is this?" }),
|
|
25
|
+
/* @__PURE__ */ jsx(
|
|
26
|
+
SelectList,
|
|
27
|
+
{
|
|
28
|
+
items: TEMPLATE_ITEMS,
|
|
29
|
+
onSelect: (value) => onDone(value),
|
|
30
|
+
onCancel: () => onDone(null)
|
|
31
|
+
}
|
|
32
|
+
),
|
|
33
|
+
/* @__PURE__ */ jsx(KeyHintFooter, {})
|
|
34
|
+
] });
|
|
35
|
+
}
|
|
36
|
+
async function promptForTemplate() {
|
|
37
|
+
return new Promise((resolve) => {
|
|
38
|
+
const instance = render(
|
|
39
|
+
/* @__PURE__ */ jsx(
|
|
40
|
+
Wizard,
|
|
41
|
+
{
|
|
42
|
+
onDone: (template) => {
|
|
43
|
+
instance.unmount();
|
|
44
|
+
resolve(template);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
export {
|
|
52
|
+
promptForTemplate
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=init-wizard-MXAFTYCQ.js.map
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildSchemaJson
|
|
3
|
+
} from "./chunk-JVEULAOD.js";
|
|
4
|
+
import {
|
|
5
|
+
FramedPanel,
|
|
6
|
+
TextInput
|
|
7
|
+
} from "./chunk-UWXPACZ7.js";
|
|
8
|
+
import {
|
|
9
|
+
StepIndicator
|
|
10
|
+
} from "./chunk-KFHC377Y.js";
|
|
11
|
+
import {
|
|
12
|
+
KeyHintFooter
|
|
13
|
+
} from "./chunk-6AVERKMZ.js";
|
|
14
|
+
import "./chunk-BJYMGFW2.js";
|
|
15
|
+
|
|
16
|
+
// src/ui/new-schema-wizard.tsx
|
|
17
|
+
import { useState } from "react";
|
|
18
|
+
import { Box, render, Text, useInput } from "ink";
|
|
19
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
20
|
+
var VALID_TYPES = ["string", "integer", "number", "boolean"];
|
|
21
|
+
function isSchemaFieldType(value) {
|
|
22
|
+
return VALID_TYPES.includes(value);
|
|
23
|
+
}
|
|
24
|
+
function Wizard({ onDone }) {
|
|
25
|
+
const [stage, setStage] = useState("name");
|
|
26
|
+
const [name, setName] = useState("");
|
|
27
|
+
const [description, setDescription] = useState("");
|
|
28
|
+
const [fields, setFields] = useState([]);
|
|
29
|
+
const [fieldName, setFieldName] = useState("");
|
|
30
|
+
const [fieldType, setFieldType] = useState(null);
|
|
31
|
+
const [draft, setDraft] = useState("");
|
|
32
|
+
useInput((_input, key) => {
|
|
33
|
+
if (key.escape) onDone(null);
|
|
34
|
+
});
|
|
35
|
+
function finish(finalFields) {
|
|
36
|
+
if (finalFields.length === 0) {
|
|
37
|
+
onDone(null);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const [first, ...rest] = finalFields;
|
|
41
|
+
onDone({ name, description, fields: [first, ...rest] });
|
|
42
|
+
}
|
|
43
|
+
function handleSubmit(value) {
|
|
44
|
+
const trimmed = value.trim();
|
|
45
|
+
if (stage === "name") {
|
|
46
|
+
if (trimmed.length === 0) return;
|
|
47
|
+
setName(trimmed);
|
|
48
|
+
setDraft("");
|
|
49
|
+
setStage("description");
|
|
50
|
+
} else if (stage === "description") {
|
|
51
|
+
if (trimmed.length === 0) return;
|
|
52
|
+
setDescription(trimmed);
|
|
53
|
+
setDraft("");
|
|
54
|
+
setStage("field-name");
|
|
55
|
+
} else if (stage === "field-name") {
|
|
56
|
+
if (trimmed.length === 0) return;
|
|
57
|
+
setFieldName(trimmed);
|
|
58
|
+
setDraft("");
|
|
59
|
+
setStage("field-type");
|
|
60
|
+
} else if (stage === "field-type") {
|
|
61
|
+
if (!isSchemaFieldType(trimmed)) return;
|
|
62
|
+
setFieldType(trimmed);
|
|
63
|
+
setDraft("");
|
|
64
|
+
setStage("field-description");
|
|
65
|
+
} else if (stage === "field-description") {
|
|
66
|
+
if (trimmed.length === 0 || !fieldType) return;
|
|
67
|
+
const nextFields = [...fields, { name: fieldName, type: fieldType, description: trimmed }];
|
|
68
|
+
setFields(nextFields);
|
|
69
|
+
setFieldName("");
|
|
70
|
+
setFieldType(null);
|
|
71
|
+
setDraft("");
|
|
72
|
+
setStage("more-fields");
|
|
73
|
+
} else if (stage === "more-fields") {
|
|
74
|
+
if (trimmed.toLowerCase().startsWith("n")) {
|
|
75
|
+
finish(fields);
|
|
76
|
+
} else {
|
|
77
|
+
setDraft("");
|
|
78
|
+
setStage("field-name");
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const question = {
|
|
83
|
+
name: "What should this schema be called?",
|
|
84
|
+
description: "What is this schema for, in one sentence?",
|
|
85
|
+
"field-name": "Add a field. What is its name?",
|
|
86
|
+
"field-type": "What type is it? (string, integer, number, or boolean)",
|
|
87
|
+
"field-description": "What does this field mean?",
|
|
88
|
+
"more-fields": "Add another field? (y/n)"
|
|
89
|
+
}[stage];
|
|
90
|
+
const previewFields = fieldType ? [...fields, { name: fieldName, type: fieldType, description: "(description)" }] : fields;
|
|
91
|
+
const preview = name.length > 0 && previewFields.length > 0 ? buildSchemaJson({
|
|
92
|
+
name,
|
|
93
|
+
description: description || "(description)",
|
|
94
|
+
fields: previewFields
|
|
95
|
+
}) : "";
|
|
96
|
+
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
|
|
97
|
+
/* @__PURE__ */ jsx(StepIndicator, { current: fields.length + 1, total: fields.length + 1, label: "Schema fields" }),
|
|
98
|
+
/* @__PURE__ */ jsx(Text, { children: question }),
|
|
99
|
+
/* @__PURE__ */ jsx(TextInput, { value: draft, onChange: setDraft, onSubmit: handleSubmit }),
|
|
100
|
+
/* @__PURE__ */ jsx(FramedPanel, { title: "Preview", children: /* @__PURE__ */ jsx(Text, { children: preview || "(nothing yet)" }) }),
|
|
101
|
+
/* @__PURE__ */ jsx(KeyHintFooter, { hints: "enter submit \xB7 esc cancel" })
|
|
102
|
+
] });
|
|
103
|
+
}
|
|
104
|
+
async function promptForSchemaAnswers() {
|
|
105
|
+
return new Promise((resolve) => {
|
|
106
|
+
const instance = render(
|
|
107
|
+
/* @__PURE__ */ jsx(
|
|
108
|
+
Wizard,
|
|
109
|
+
{
|
|
110
|
+
onDone: (answers) => {
|
|
111
|
+
instance.unmount();
|
|
112
|
+
resolve(answers);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
)
|
|
116
|
+
);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
export {
|
|
120
|
+
Wizard,
|
|
121
|
+
promptForSchemaAnswers
|
|
122
|
+
};
|
|
123
|
+
//# sourceMappingURL=new-schema-wizard-NYIHF47J.js.map
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildSkillMarkdown
|
|
3
|
+
} from "./chunk-52CMOWJF.js";
|
|
4
|
+
import {
|
|
5
|
+
FramedPanel,
|
|
6
|
+
TextInput
|
|
7
|
+
} from "./chunk-UWXPACZ7.js";
|
|
8
|
+
import {
|
|
9
|
+
StepIndicator
|
|
10
|
+
} from "./chunk-KFHC377Y.js";
|
|
11
|
+
import {
|
|
12
|
+
KeyHintFooter
|
|
13
|
+
} from "./chunk-6AVERKMZ.js";
|
|
14
|
+
import "./chunk-BJYMGFW2.js";
|
|
15
|
+
|
|
16
|
+
// src/ui/new-skill-wizard.tsx
|
|
17
|
+
import { useState } from "react";
|
|
18
|
+
import { Box, render, Text, useInput } from "ink";
|
|
19
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
20
|
+
var STEPS = [
|
|
21
|
+
{
|
|
22
|
+
key: "name",
|
|
23
|
+
question: "What should this skill be called (folder name, lowercase-with-dashes)?"
|
|
24
|
+
},
|
|
25
|
+
{ key: "owner", question: "Who owns this decision?" },
|
|
26
|
+
{ key: "purpose", question: "What decision is this?" },
|
|
27
|
+
{ key: "whenToUse", question: "When does it happen?" },
|
|
28
|
+
{ key: "input", question: "What information does this decision need?" },
|
|
29
|
+
{ key: "decisionLogic", question: "What are the rules?" },
|
|
30
|
+
{ key: "exceptions", question: "What are the exceptions?" },
|
|
31
|
+
{ key: "output", question: "What does this decision produce?" },
|
|
32
|
+
{ key: "example1", question: "Give a real example (1 of 2)." },
|
|
33
|
+
{ key: "example2", question: "Give a real example (2 of 2)." }
|
|
34
|
+
];
|
|
35
|
+
var EMPTY_ANSWERS = {
|
|
36
|
+
name: "",
|
|
37
|
+
owner: "",
|
|
38
|
+
purpose: "",
|
|
39
|
+
whenToUse: "",
|
|
40
|
+
input: "",
|
|
41
|
+
decisionLogic: "",
|
|
42
|
+
exceptions: "",
|
|
43
|
+
output: "",
|
|
44
|
+
example1: "",
|
|
45
|
+
example2: ""
|
|
46
|
+
};
|
|
47
|
+
function previewMarkdown(answers) {
|
|
48
|
+
if (!answers.name) return "";
|
|
49
|
+
return buildSkillMarkdown({
|
|
50
|
+
name: answers.name || "skill-name",
|
|
51
|
+
owner: answers.owner || "(owner)",
|
|
52
|
+
purpose: answers.purpose || "(purpose)",
|
|
53
|
+
whenToUse: answers.whenToUse || "(when to use)",
|
|
54
|
+
input: answers.input || "(input)",
|
|
55
|
+
decisionLogic: answers.decisionLogic || "(decision logic)",
|
|
56
|
+
exceptions: answers.exceptions || "(exceptions)",
|
|
57
|
+
output: answers.output || "(output)",
|
|
58
|
+
examples: [answers.example1 || "(example 1)", answers.example2 || "(example 2)"]
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function Wizard({ onDone }) {
|
|
62
|
+
const [stepIndex, setStepIndex] = useState(0);
|
|
63
|
+
const [answers, setAnswers] = useState(EMPTY_ANSWERS);
|
|
64
|
+
const [draft, setDraft] = useState("");
|
|
65
|
+
useInput((_input, key) => {
|
|
66
|
+
if (key.escape) onDone(null);
|
|
67
|
+
});
|
|
68
|
+
const step = STEPS[stepIndex];
|
|
69
|
+
if (!step) {
|
|
70
|
+
return /* @__PURE__ */ jsx(Text, { children: "Done." });
|
|
71
|
+
}
|
|
72
|
+
function handleSubmit(value) {
|
|
73
|
+
const trimmed = value.trim();
|
|
74
|
+
if (trimmed.length === 0) return;
|
|
75
|
+
const nextAnswers = { ...answers, [step.key]: trimmed };
|
|
76
|
+
setAnswers(nextAnswers);
|
|
77
|
+
setDraft("");
|
|
78
|
+
if (stepIndex + 1 >= STEPS.length) {
|
|
79
|
+
onDone({
|
|
80
|
+
name: nextAnswers.name,
|
|
81
|
+
owner: nextAnswers.owner,
|
|
82
|
+
purpose: nextAnswers.purpose,
|
|
83
|
+
whenToUse: nextAnswers.whenToUse,
|
|
84
|
+
input: nextAnswers.input,
|
|
85
|
+
decisionLogic: nextAnswers.decisionLogic,
|
|
86
|
+
exceptions: nextAnswers.exceptions,
|
|
87
|
+
output: nextAnswers.output,
|
|
88
|
+
examples: [nextAnswers.example1, nextAnswers.example2]
|
|
89
|
+
});
|
|
90
|
+
} else {
|
|
91
|
+
setStepIndex(stepIndex + 1);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
|
|
95
|
+
/* @__PURE__ */ jsx(StepIndicator, { current: stepIndex + 1, total: STEPS.length }),
|
|
96
|
+
/* @__PURE__ */ jsx(Text, { children: step.question }),
|
|
97
|
+
/* @__PURE__ */ jsx(TextInput, { value: draft, onChange: setDraft, onSubmit: handleSubmit }),
|
|
98
|
+
/* @__PURE__ */ jsx(FramedPanel, { title: "Preview", children: /* @__PURE__ */ jsx(Text, { children: previewMarkdown(answers) || "(nothing yet)" }) }),
|
|
99
|
+
/* @__PURE__ */ jsx(KeyHintFooter, { hints: "enter submit \xB7 esc cancel" })
|
|
100
|
+
] });
|
|
101
|
+
}
|
|
102
|
+
async function promptForSkillAnswers() {
|
|
103
|
+
return new Promise((resolve) => {
|
|
104
|
+
const instance = render(
|
|
105
|
+
/* @__PURE__ */ jsx(
|
|
106
|
+
Wizard,
|
|
107
|
+
{
|
|
108
|
+
onDone: (answers) => {
|
|
109
|
+
instance.unmount();
|
|
110
|
+
resolve(answers);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
)
|
|
114
|
+
);
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
export {
|
|
118
|
+
Wizard,
|
|
119
|
+
promptForSkillAnswers
|
|
120
|
+
};
|
|
121
|
+
//# sourceMappingURL=new-skill-wizard-AZJ5DLDM.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,68 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codsy/cli",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Write operational knowledge as versioned files that people and AI agents can both read.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"author": "Codsy Contributors",
|
|
8
|
+
"homepage": "https://github.com/faelreis/codsy#readme",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/faelreis/codsy.git"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/faelreis/codsy/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"cli",
|
|
18
|
+
"skills",
|
|
19
|
+
"agent-skills",
|
|
20
|
+
"operational-knowledge",
|
|
21
|
+
"lint",
|
|
22
|
+
"ai-agents"
|
|
23
|
+
],
|
|
24
|
+
"bin": {
|
|
25
|
+
"codsy": "./dist/cli.js"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist",
|
|
29
|
+
"!dist/**/*.map",
|
|
30
|
+
"templates"
|
|
31
|
+
],
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
},
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">=22.12.0"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"ajv": "^8.20.0",
|
|
40
|
+
"ink": "^8.0.0",
|
|
41
|
+
"js-yaml": "^5.5.0",
|
|
42
|
+
"react": "^19.3.1"
|
|
43
|
+
},
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "tsup",
|
|
46
|
+
"dev": "tsup --watch",
|
|
47
|
+
"lint": "eslint .",
|
|
48
|
+
"lint:fix": "eslint . --fix",
|
|
49
|
+
"format": "prettier --write .",
|
|
50
|
+
"format:check": "prettier --check .",
|
|
51
|
+
"typecheck": "tsc --noEmit",
|
|
52
|
+
"test": "vitest run",
|
|
53
|
+
"test:watch": "vitest"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@eslint/js": "^10.0.1",
|
|
57
|
+
"@types/node": "^22.20.1",
|
|
58
|
+
"@types/react": "^19.3.0",
|
|
59
|
+
"eslint": "^10.14.0",
|
|
60
|
+
"eslint-config-prettier": "^10.1.8",
|
|
61
|
+
"ink-testing-library": "^4.0.0",
|
|
62
|
+
"prettier": "^3.10.1",
|
|
63
|
+
"tsup": "^9.0.0",
|
|
64
|
+
"typescript": "5.9.3",
|
|
65
|
+
"typescript-eslint": "^8.72.2",
|
|
66
|
+
"vitest": "^5.1.0"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
name: Codsy
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
|
|
6
|
+
permissions:
|
|
7
|
+
contents: read
|
|
8
|
+
pull-requests: write
|
|
9
|
+
security-events: write
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
check:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v7
|
|
16
|
+
- uses: faelreis/codsy/action@v1
|
|
17
|
+
with:
|
|
18
|
+
strict: true
|
|
19
|
+
|
|
20
|
+
eval:
|
|
21
|
+
if: ${{ secrets.ANTHROPIC_API_KEY != '' || secrets.OPENAI_API_KEY != '' }}
|
|
22
|
+
needs: check
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
steps:
|
|
25
|
+
- uses: actions/checkout@v7
|
|
26
|
+
- uses: actions/setup-node@v7
|
|
27
|
+
with:
|
|
28
|
+
node-version: '22'
|
|
29
|
+
- run: npm install -g @codsy/cli
|
|
30
|
+
- run: codsy eval --threshold 0.8
|
|
31
|
+
env:
|
|
32
|
+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
33
|
+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Agent instructions
|
|
2
|
+
|
|
3
|
+
This project's operational knowledge lives in `schemas/`, `skills/`, `context/`, and
|
|
4
|
+
`evals/`. Read `context/company.md` first for background, then the relevant files under
|
|
5
|
+
`skills/` for the specific decision you are making. Each skill's `SKILL.md` states its
|
|
6
|
+
input, decision logic, exceptions, and expected output.
|
|
7
|
+
|
|
8
|
+
Run `codsy check` before opening a pull request that changes any of these files.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Operational knowledge
|
|
2
|
+
|
|
3
|
+
This repository holds the operational knowledge for this business, managed with
|
|
4
|
+
[Codsy](https://github.com/faelreis/codsy): schemas (what the business is), skills (what it
|
|
5
|
+
knows), context (why), and evals (proof it works).
|
|
6
|
+
|
|
7
|
+
- `schemas/` — the structured data this business works with.
|
|
8
|
+
- `skills/` — the decisions this business makes and the rules behind them.
|
|
9
|
+
- `context/` — background that explains why those rules exist.
|
|
10
|
+
- `evals/` — real and realistic cases used to check that each skill decides correctly.
|
|
11
|
+
|
|
12
|
+
Run `codsy check` to find problems. Run `codsy new skill` to add a new decision.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
severities: {}
|
|
File without changes
|