@kaddo/cli 3.74.0 → 3.74.1
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.js +191 -170
- package/package.json +1 -1
package/dist/core.js
CHANGED
|
@@ -7724,6 +7724,194 @@ import fs2 from "fs";
|
|
|
7724
7724
|
import path2 from "path";
|
|
7725
7725
|
import crypto from "crypto";
|
|
7726
7726
|
import matter7 from "gray-matter";
|
|
7727
|
+
|
|
7728
|
+
// src/core/knowledge-levels.ts
|
|
7729
|
+
var WORK_ITEM_TYPES2 = ["feature", "bugfix", "hotfix", "spike", "chore"];
|
|
7730
|
+
var TYPE_ALIASES = {
|
|
7731
|
+
setup: "chore",
|
|
7732
|
+
maintenance: "chore",
|
|
7733
|
+
tooling: "chore",
|
|
7734
|
+
infrastructure: "chore",
|
|
7735
|
+
infra: "chore",
|
|
7736
|
+
config: "chore",
|
|
7737
|
+
configuration: "chore",
|
|
7738
|
+
refactor: "chore"
|
|
7739
|
+
};
|
|
7740
|
+
var LEVELS = {
|
|
7741
|
+
K0: {
|
|
7742
|
+
level: "K0",
|
|
7743
|
+
description: "Trivial change. No formal knowledge required.",
|
|
7744
|
+
questions: [],
|
|
7745
|
+
qualityGate: []
|
|
7746
|
+
},
|
|
7747
|
+
K1: {
|
|
7748
|
+
level: "K1",
|
|
7749
|
+
description: "Simple fix or hotfix.",
|
|
7750
|
+
questions: [
|
|
7751
|
+
{
|
|
7752
|
+
id: "problem",
|
|
7753
|
+
prompt: "What problem does this fix?",
|
|
7754
|
+
placeholder: "e.g. Button is not clickable on mobile",
|
|
7755
|
+
frontMatterField: "problem",
|
|
7756
|
+
required: true
|
|
7757
|
+
},
|
|
7758
|
+
{
|
|
7759
|
+
id: "expected_result",
|
|
7760
|
+
prompt: "What is the expected result after the fix?",
|
|
7761
|
+
placeholder: "e.g. Button works correctly on all screen sizes",
|
|
7762
|
+
frontMatterField: "expected_result",
|
|
7763
|
+
required: true
|
|
7764
|
+
}
|
|
7765
|
+
],
|
|
7766
|
+
qualityGate: ["Problem is clear.", "Expected result is defined."]
|
|
7767
|
+
},
|
|
7768
|
+
K2: {
|
|
7769
|
+
level: "K2",
|
|
7770
|
+
description: "Feature or bugfix with functional impact.",
|
|
7771
|
+
questions: [
|
|
7772
|
+
{
|
|
7773
|
+
id: "problem",
|
|
7774
|
+
prompt: "What problem does this solve?",
|
|
7775
|
+
placeholder: "e.g. Users cannot complete checkout without email verification",
|
|
7776
|
+
frontMatterField: "problem",
|
|
7777
|
+
required: true
|
|
7778
|
+
},
|
|
7779
|
+
{
|
|
7780
|
+
id: "expected_result",
|
|
7781
|
+
prompt: "What is the expected result?",
|
|
7782
|
+
placeholder: "e.g. Users can verify email inline during checkout",
|
|
7783
|
+
frontMatterField: "expected_result",
|
|
7784
|
+
required: true
|
|
7785
|
+
},
|
|
7786
|
+
{
|
|
7787
|
+
id: "impact",
|
|
7788
|
+
prompt: "What is the impact if this is not done?",
|
|
7789
|
+
placeholder: "e.g. ~30% of users drop off at checkout",
|
|
7790
|
+
frontMatterField: "impact",
|
|
7791
|
+
required: true
|
|
7792
|
+
},
|
|
7793
|
+
{
|
|
7794
|
+
id: "acceptance_criteria",
|
|
7795
|
+
prompt: "What are the acceptance criteria? (one per line, press Enter twice to finish)",
|
|
7796
|
+
placeholder: "e.g. Email is verified before payment step",
|
|
7797
|
+
frontMatterField: "acceptance_criteria",
|
|
7798
|
+
required: true
|
|
7799
|
+
}
|
|
7800
|
+
],
|
|
7801
|
+
qualityGate: [
|
|
7802
|
+
"Problem is clear.",
|
|
7803
|
+
"Expected result is defined.",
|
|
7804
|
+
"Impact of not doing it is stated.",
|
|
7805
|
+
"Acceptance criteria are verifiable."
|
|
7806
|
+
]
|
|
7807
|
+
},
|
|
7808
|
+
K3: {
|
|
7809
|
+
level: "K3",
|
|
7810
|
+
description: "Capability, integration, or significant functional change.",
|
|
7811
|
+
questions: [
|
|
7812
|
+
{
|
|
7813
|
+
id: "problem",
|
|
7814
|
+
prompt: "What problem does this solve?",
|
|
7815
|
+
placeholder: "e.g. Payments need to support multiple providers",
|
|
7816
|
+
frontMatterField: "problem",
|
|
7817
|
+
required: true
|
|
7818
|
+
},
|
|
7819
|
+
{
|
|
7820
|
+
id: "impact",
|
|
7821
|
+
prompt: "What is the impact if this is not done?",
|
|
7822
|
+
placeholder: "e.g. We are locked into a single provider with no fallback",
|
|
7823
|
+
frontMatterField: "impact",
|
|
7824
|
+
required: true
|
|
7825
|
+
},
|
|
7826
|
+
{
|
|
7827
|
+
id: "acceptance_criteria",
|
|
7828
|
+
prompt: "What are the acceptance criteria?",
|
|
7829
|
+
placeholder: "e.g. System routes to provider B when provider A fails",
|
|
7830
|
+
frontMatterField: "acceptance_criteria",
|
|
7831
|
+
required: true
|
|
7832
|
+
},
|
|
7833
|
+
{
|
|
7834
|
+
id: "design",
|
|
7835
|
+
prompt: "What is the proposed design or approach?",
|
|
7836
|
+
placeholder: "e.g. Abstract provider interface + strategy pattern",
|
|
7837
|
+
frontMatterField: "design",
|
|
7838
|
+
required: true
|
|
7839
|
+
}
|
|
7840
|
+
],
|
|
7841
|
+
qualityGate: [
|
|
7842
|
+
"Problem is clear.",
|
|
7843
|
+
"Impact is stated.",
|
|
7844
|
+
"Acceptance criteria are verifiable.",
|
|
7845
|
+
"Design is sufficient to start."
|
|
7846
|
+
]
|
|
7847
|
+
},
|
|
7848
|
+
K4: {
|
|
7849
|
+
level: "K4",
|
|
7850
|
+
description: "Architecture change, migration, or high-risk decision.",
|
|
7851
|
+
questions: [
|
|
7852
|
+
{
|
|
7853
|
+
id: "problem",
|
|
7854
|
+
prompt: "What problem does this solve?",
|
|
7855
|
+
placeholder: "e.g. Current auth system does not support SSO",
|
|
7856
|
+
frontMatterField: "problem",
|
|
7857
|
+
required: true
|
|
7858
|
+
},
|
|
7859
|
+
{
|
|
7860
|
+
id: "impact",
|
|
7861
|
+
prompt: "What is the impact if this is not done?",
|
|
7862
|
+
placeholder: "e.g. Enterprise clients cannot onboard",
|
|
7863
|
+
frontMatterField: "impact",
|
|
7864
|
+
required: true
|
|
7865
|
+
},
|
|
7866
|
+
{
|
|
7867
|
+
id: "design",
|
|
7868
|
+
prompt: "What is the proposed design or approach?",
|
|
7869
|
+
placeholder: "e.g. Replace JWT-only auth with OIDC + JWT hybrid",
|
|
7870
|
+
frontMatterField: "design",
|
|
7871
|
+
required: true
|
|
7872
|
+
},
|
|
7873
|
+
{
|
|
7874
|
+
id: "risks",
|
|
7875
|
+
prompt: "What are the main risks?",
|
|
7876
|
+
placeholder: "e.g. Existing sessions may be invalidated during migration",
|
|
7877
|
+
frontMatterField: "risks",
|
|
7878
|
+
required: true
|
|
7879
|
+
}
|
|
7880
|
+
],
|
|
7881
|
+
qualityGate: [
|
|
7882
|
+
"Problem is clear.",
|
|
7883
|
+
"Impact is stated.",
|
|
7884
|
+
"Design is documented.",
|
|
7885
|
+
"Risks are identified.",
|
|
7886
|
+
"ADR is created or linked if applicable."
|
|
7887
|
+
]
|
|
7888
|
+
}
|
|
7889
|
+
};
|
|
7890
|
+
var TYPE_TO_LEVEL = {
|
|
7891
|
+
hotfix: "K1",
|
|
7892
|
+
bugfix: "K2",
|
|
7893
|
+
feature: "K2",
|
|
7894
|
+
spike: "K3",
|
|
7895
|
+
// Chores are maintenance/config/tooling work — low ceremony (problem + expected result).
|
|
7896
|
+
chore: "K1"
|
|
7897
|
+
};
|
|
7898
|
+
function getLevel(level) {
|
|
7899
|
+
return LEVELS[level];
|
|
7900
|
+
}
|
|
7901
|
+
function getLevelForType(type) {
|
|
7902
|
+
return TYPE_TO_LEVEL[type];
|
|
7903
|
+
}
|
|
7904
|
+
function isValidType(type) {
|
|
7905
|
+
return WORK_ITEM_TYPES2.includes(type);
|
|
7906
|
+
}
|
|
7907
|
+
function normalizeType(raw) {
|
|
7908
|
+
if (!raw) return null;
|
|
7909
|
+
const t = raw.trim().toLowerCase();
|
|
7910
|
+
if (isValidType(t)) return t;
|
|
7911
|
+
return TYPE_ALIASES[t] ?? null;
|
|
7912
|
+
}
|
|
7913
|
+
|
|
7914
|
+
// src/core/work-item-write.ts
|
|
7727
7915
|
var WORK_ITEMS_DIR = "knowledge/delivery/work-items";
|
|
7728
7916
|
var WorkItemWriteError = class extends Error {
|
|
7729
7917
|
constructor(code, message) {
|
|
@@ -8032,8 +8220,8 @@ function captureBody(title, type, answers) {
|
|
|
8032
8220
|
function createWorkItem(dir, opts) {
|
|
8033
8221
|
const intent = opts.intent.trim();
|
|
8034
8222
|
if (!intent) throw new WorkItemWriteError("INVALID_INPUT", "An intent or summary is required.");
|
|
8035
|
-
const type = opts.type.trim()
|
|
8036
|
-
if (!
|
|
8223
|
+
const type = normalizeType(opts.type.trim()) ?? "";
|
|
8224
|
+
if (!type) throw new WorkItemWriteError("INVALID_INPUT", `Unknown Work Item type "${opts.type}".`);
|
|
8037
8225
|
const id = nextWorkItemId(dir);
|
|
8038
8226
|
const title = intent.split(/\r?\n/)[0].trim().slice(0, 120);
|
|
8039
8227
|
const today = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
@@ -8073,7 +8261,7 @@ function createWorkItem(dir, opts) {
|
|
|
8073
8261
|
}
|
|
8074
8262
|
function validateInput(input) {
|
|
8075
8263
|
if (!input.title.trim()) throw new WorkItemWriteError("INVALID_INPUT", "Title is required.");
|
|
8076
|
-
if (!
|
|
8264
|
+
if (!isValidType(input.type)) throw new WorkItemWriteError("INVALID_INPUT", `Unknown Work Item type "${input.type}".`);
|
|
8077
8265
|
}
|
|
8078
8266
|
function updateWorkItem(dir, id, input, expectedRevision) {
|
|
8079
8267
|
validateInput(input);
|
|
@@ -8152,173 +8340,6 @@ function transitionWorkItem(dir, id, to, expectedRevision) {
|
|
|
8152
8340
|
return { revision: revisionOf(nextRaw), status: to, path: targetRel };
|
|
8153
8341
|
}
|
|
8154
8342
|
|
|
8155
|
-
// src/core/knowledge-levels.ts
|
|
8156
|
-
var WORK_ITEM_TYPES2 = ["feature", "bugfix", "hotfix", "spike", "chore"];
|
|
8157
|
-
var LEVELS = {
|
|
8158
|
-
K0: {
|
|
8159
|
-
level: "K0",
|
|
8160
|
-
description: "Trivial change. No formal knowledge required.",
|
|
8161
|
-
questions: [],
|
|
8162
|
-
qualityGate: []
|
|
8163
|
-
},
|
|
8164
|
-
K1: {
|
|
8165
|
-
level: "K1",
|
|
8166
|
-
description: "Simple fix or hotfix.",
|
|
8167
|
-
questions: [
|
|
8168
|
-
{
|
|
8169
|
-
id: "problem",
|
|
8170
|
-
prompt: "What problem does this fix?",
|
|
8171
|
-
placeholder: "e.g. Button is not clickable on mobile",
|
|
8172
|
-
frontMatterField: "problem",
|
|
8173
|
-
required: true
|
|
8174
|
-
},
|
|
8175
|
-
{
|
|
8176
|
-
id: "expected_result",
|
|
8177
|
-
prompt: "What is the expected result after the fix?",
|
|
8178
|
-
placeholder: "e.g. Button works correctly on all screen sizes",
|
|
8179
|
-
frontMatterField: "expected_result",
|
|
8180
|
-
required: true
|
|
8181
|
-
}
|
|
8182
|
-
],
|
|
8183
|
-
qualityGate: ["Problem is clear.", "Expected result is defined."]
|
|
8184
|
-
},
|
|
8185
|
-
K2: {
|
|
8186
|
-
level: "K2",
|
|
8187
|
-
description: "Feature or bugfix with functional impact.",
|
|
8188
|
-
questions: [
|
|
8189
|
-
{
|
|
8190
|
-
id: "problem",
|
|
8191
|
-
prompt: "What problem does this solve?",
|
|
8192
|
-
placeholder: "e.g. Users cannot complete checkout without email verification",
|
|
8193
|
-
frontMatterField: "problem",
|
|
8194
|
-
required: true
|
|
8195
|
-
},
|
|
8196
|
-
{
|
|
8197
|
-
id: "expected_result",
|
|
8198
|
-
prompt: "What is the expected result?",
|
|
8199
|
-
placeholder: "e.g. Users can verify email inline during checkout",
|
|
8200
|
-
frontMatterField: "expected_result",
|
|
8201
|
-
required: true
|
|
8202
|
-
},
|
|
8203
|
-
{
|
|
8204
|
-
id: "impact",
|
|
8205
|
-
prompt: "What is the impact if this is not done?",
|
|
8206
|
-
placeholder: "e.g. ~30% of users drop off at checkout",
|
|
8207
|
-
frontMatterField: "impact",
|
|
8208
|
-
required: true
|
|
8209
|
-
},
|
|
8210
|
-
{
|
|
8211
|
-
id: "acceptance_criteria",
|
|
8212
|
-
prompt: "What are the acceptance criteria? (one per line, press Enter twice to finish)",
|
|
8213
|
-
placeholder: "e.g. Email is verified before payment step",
|
|
8214
|
-
frontMatterField: "acceptance_criteria",
|
|
8215
|
-
required: true
|
|
8216
|
-
}
|
|
8217
|
-
],
|
|
8218
|
-
qualityGate: [
|
|
8219
|
-
"Problem is clear.",
|
|
8220
|
-
"Expected result is defined.",
|
|
8221
|
-
"Impact of not doing it is stated.",
|
|
8222
|
-
"Acceptance criteria are verifiable."
|
|
8223
|
-
]
|
|
8224
|
-
},
|
|
8225
|
-
K3: {
|
|
8226
|
-
level: "K3",
|
|
8227
|
-
description: "Capability, integration, or significant functional change.",
|
|
8228
|
-
questions: [
|
|
8229
|
-
{
|
|
8230
|
-
id: "problem",
|
|
8231
|
-
prompt: "What problem does this solve?",
|
|
8232
|
-
placeholder: "e.g. Payments need to support multiple providers",
|
|
8233
|
-
frontMatterField: "problem",
|
|
8234
|
-
required: true
|
|
8235
|
-
},
|
|
8236
|
-
{
|
|
8237
|
-
id: "impact",
|
|
8238
|
-
prompt: "What is the impact if this is not done?",
|
|
8239
|
-
placeholder: "e.g. We are locked into a single provider with no fallback",
|
|
8240
|
-
frontMatterField: "impact",
|
|
8241
|
-
required: true
|
|
8242
|
-
},
|
|
8243
|
-
{
|
|
8244
|
-
id: "acceptance_criteria",
|
|
8245
|
-
prompt: "What are the acceptance criteria?",
|
|
8246
|
-
placeholder: "e.g. System routes to provider B when provider A fails",
|
|
8247
|
-
frontMatterField: "acceptance_criteria",
|
|
8248
|
-
required: true
|
|
8249
|
-
},
|
|
8250
|
-
{
|
|
8251
|
-
id: "design",
|
|
8252
|
-
prompt: "What is the proposed design or approach?",
|
|
8253
|
-
placeholder: "e.g. Abstract provider interface + strategy pattern",
|
|
8254
|
-
frontMatterField: "design",
|
|
8255
|
-
required: true
|
|
8256
|
-
}
|
|
8257
|
-
],
|
|
8258
|
-
qualityGate: [
|
|
8259
|
-
"Problem is clear.",
|
|
8260
|
-
"Impact is stated.",
|
|
8261
|
-
"Acceptance criteria are verifiable.",
|
|
8262
|
-
"Design is sufficient to start."
|
|
8263
|
-
]
|
|
8264
|
-
},
|
|
8265
|
-
K4: {
|
|
8266
|
-
level: "K4",
|
|
8267
|
-
description: "Architecture change, migration, or high-risk decision.",
|
|
8268
|
-
questions: [
|
|
8269
|
-
{
|
|
8270
|
-
id: "problem",
|
|
8271
|
-
prompt: "What problem does this solve?",
|
|
8272
|
-
placeholder: "e.g. Current auth system does not support SSO",
|
|
8273
|
-
frontMatterField: "problem",
|
|
8274
|
-
required: true
|
|
8275
|
-
},
|
|
8276
|
-
{
|
|
8277
|
-
id: "impact",
|
|
8278
|
-
prompt: "What is the impact if this is not done?",
|
|
8279
|
-
placeholder: "e.g. Enterprise clients cannot onboard",
|
|
8280
|
-
frontMatterField: "impact",
|
|
8281
|
-
required: true
|
|
8282
|
-
},
|
|
8283
|
-
{
|
|
8284
|
-
id: "design",
|
|
8285
|
-
prompt: "What is the proposed design or approach?",
|
|
8286
|
-
placeholder: "e.g. Replace JWT-only auth with OIDC + JWT hybrid",
|
|
8287
|
-
frontMatterField: "design",
|
|
8288
|
-
required: true
|
|
8289
|
-
},
|
|
8290
|
-
{
|
|
8291
|
-
id: "risks",
|
|
8292
|
-
prompt: "What are the main risks?",
|
|
8293
|
-
placeholder: "e.g. Existing sessions may be invalidated during migration",
|
|
8294
|
-
frontMatterField: "risks",
|
|
8295
|
-
required: true
|
|
8296
|
-
}
|
|
8297
|
-
],
|
|
8298
|
-
qualityGate: [
|
|
8299
|
-
"Problem is clear.",
|
|
8300
|
-
"Impact is stated.",
|
|
8301
|
-
"Design is documented.",
|
|
8302
|
-
"Risks are identified.",
|
|
8303
|
-
"ADR is created or linked if applicable."
|
|
8304
|
-
]
|
|
8305
|
-
}
|
|
8306
|
-
};
|
|
8307
|
-
var TYPE_TO_LEVEL = {
|
|
8308
|
-
hotfix: "K1",
|
|
8309
|
-
bugfix: "K2",
|
|
8310
|
-
feature: "K2",
|
|
8311
|
-
spike: "K3",
|
|
8312
|
-
// Chores are maintenance/config/tooling work — low ceremony (problem + expected result).
|
|
8313
|
-
chore: "K1"
|
|
8314
|
-
};
|
|
8315
|
-
function getLevel(level) {
|
|
8316
|
-
return LEVELS[level];
|
|
8317
|
-
}
|
|
8318
|
-
function getLevelForType(type) {
|
|
8319
|
-
return TYPE_TO_LEVEL[type];
|
|
8320
|
-
}
|
|
8321
|
-
|
|
8322
8343
|
// src/core/work-item-refinement.ts
|
|
8323
8344
|
function toCapture(q) {
|
|
8324
8345
|
return { id: q.id, prompt: q.prompt, placeholder: q.placeholder, field: q.frontMatterField, required: q.required };
|