skillwiki 0.2.1-beta.11 → 0.2.1-beta.13

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/cli.js CHANGED
@@ -162,9 +162,25 @@ var CompoundSchema = z.object({
162
162
  promoted_to: wikilink.optional(),
163
163
  cssclasses: z.array(z.string()).optional()
164
164
  });
165
+ var MetaSchema = z.object({
166
+ title: z.string().min(1),
167
+ aliases: z.array(z.string()).optional(),
168
+ created: isoDate,
169
+ updated: isoDate,
170
+ type: z.literal("meta"),
171
+ tags: z.array(z.string()),
172
+ confidence: z.enum(["high", "medium", "low"]).optional(),
173
+ provenance: z.enum(["research", "project", "mixed"]).optional(),
174
+ provenance_projects: z.array(wikilink).min(2, "meta pages must reference \u22652 projects")
175
+ }).superRefine((v, ctx) => {
176
+ if (v.provenance && v.provenance !== "research" && (!v.provenance_projects || v.provenance_projects.length === 0)) {
177
+ ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["provenance_projects"], message: "required when provenance != research" });
178
+ }
179
+ });
165
180
  function detectSchema(fm) {
166
181
  const COMPOUND_TYPES = /* @__PURE__ */ new Set(["lesson", "pattern", "antipattern", "gotcha"]);
167
182
  if (typeof fm.type === "string" && COMPOUND_TYPES.has(fm.type) && "project" in fm) return { schema: "compound" };
183
+ if (fm.type === "meta") return { schema: "meta" };
168
184
  if ("type" in fm && "sources" in fm) return { schema: "typed-knowledge" };
169
185
  if (typeof fm.sha256 === "string" && "ingested" in fm) return { schema: "raw" };
170
186
  if ("kind" in fm && "status" in fm) return { schema: "work-item" };
@@ -303,7 +319,8 @@ var SCHEMAS = {
303
319
  "typed-knowledge": TypedKnowledgeSchema,
304
320
  "raw": RawSourceSchema,
305
321
  "work-item": WorkItemSchema,
306
- "compound": CompoundSchema
322
+ "compound": CompoundSchema,
323
+ "meta": MetaSchema
307
324
  };
308
325
  async function runValidate(input) {
309
326
  let text;
@@ -342,7 +359,7 @@ import { dirname } from "path";
342
359
  // src/utils/vault.ts
343
360
  import { readFile as readFile3, readdir, stat } from "fs/promises";
344
361
  import { join, relative, sep } from "path";
345
- var TYPED_DIRS = ["entities", "concepts", "comparisons", "queries"];
362
+ var TYPED_DIRS = ["entities", "concepts", "comparisons", "queries", "meta"];
346
363
  async function scanVault(root) {
347
364
  try {
348
365
  await stat(join(root, "SCHEMA.md"));
@@ -1236,13 +1253,15 @@ async function runInit(input) {
1236
1253
  }
1237
1254
  const existingEnv = parseDotenvText(existingEnvRaw);
1238
1255
  const swDotenvHadPath = existingEnv.WIKI_PATH !== void 0;
1239
- if (!input.profile && existingEnv.WIKI_PATH !== void 0 && existingEnv.WIKI_PATH !== target && !input.force) {
1256
+ const explicitTarget = !!input.flag;
1257
+ const skipConflictCheck = explicitTarget || !!input.noEnv;
1258
+ if (!input.profile && !skipConflictCheck && existingEnv.WIKI_PATH !== void 0 && existingEnv.WIKI_PATH !== target && !input.force) {
1240
1259
  return {
1241
1260
  exitCode: ExitCode.ENV_WRITE_CONFLICT,
1242
1261
  result: err("ENV_WRITE_CONFLICT", { key: "WIKI_PATH", existing: existingEnv.WIKI_PATH, attempted: target })
1243
1262
  };
1244
1263
  }
1245
- if (!input.profile && existingEnv.WIKI_LANG !== void 0 && existingEnv.WIKI_LANG !== canonicalLang && !input.force) {
1264
+ if (!input.profile && !skipConflictCheck && existingEnv.WIKI_LANG !== void 0 && existingEnv.WIKI_LANG !== canonicalLang && !input.force) {
1246
1265
  return {
1247
1266
  exitCode: ExitCode.ENV_WRITE_CONFLICT,
1248
1267
  result: err("ENV_WRITE_CONFLICT", { key: "WIKI_LANG", existing: existingEnv.WIKI_LANG, attempted: canonicalLang })
@@ -1337,7 +1356,7 @@ async function runInit(input) {
1337
1356
  return tpl.replace(/\{\{INIT_DATE\}\}/g, today).replace("{{DOMAIN}}", domain).replace("{{WIKI_LANG}}", canonicalLang);
1338
1357
  });
1339
1358
  if (err22) return err22;
1340
- const skipEnv = !!input.noEnv;
1359
+ const skipEnv = !!input.noEnv || explicitTarget && !input.profile && swDotenvHadPath && !input.force;
1341
1360
  let envWritten = "";
1342
1361
  if (!skipEnv) {
1343
1362
  try {
@@ -1896,10 +1915,17 @@ async function runLint(input) {
1896
1915
  }
1897
1916
  let newBody = newBodyLines.join("\n");
1898
1917
  const dedupedMarkers = [...new Set(inlineMarkers)];
1899
- const sourceLines = dedupedMarkers.map((m) => `- ${m}`);
1900
1918
  if (inSrc) {
1901
- newBody = newBody.trimEnd() + "\n" + sourceLines.join("\n") + "\n";
1919
+ const existingSources = new Set(
1920
+ body.split("\n").filter((l) => /^- \^\[raw\//.test(l.trim())).map((l) => l.trim().replace(/^- /, ""))
1921
+ );
1922
+ const newMarkers = dedupedMarkers.filter((m) => !existingSources.has(m));
1923
+ const sourceLines = newMarkers.map((m) => `- ${m}`);
1924
+ if (sourceLines.length > 0) {
1925
+ newBody = newBody.trimEnd() + "\n" + sourceLines.join("\n") + "\n";
1926
+ }
1902
1927
  } else {
1928
+ const sourceLines = dedupedMarkers.map((m) => `- ${m}`);
1903
1929
  newBody = newBody.trimEnd() + "\n\n## Sources\n\n" + sourceLines.join("\n") + "\n";
1904
1930
  }
1905
1931
  const newContent = `---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skillwiki",
3
- "version": "0.2.1-beta.11",
3
+ "version": "0.2.1-beta.13",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "skillwiki": "dist/cli.js"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skillwiki",
3
- "version": "0.2.1-beta.11",
3
+ "version": "0.2.1-beta.13",
4
4
  "skills": "./",
5
5
  "description": "Project-aware Karpathy-style knowledge base for Claude Code: 15 prompt-only skills (wiki-*, proj-*, using-skillwiki) backed by the deterministic `skillwiki` CLI.",
6
6
  "author": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skillwiki/skills",
3
- "version": "0.2.1-beta.11",
3
+ "version": "0.2.1-beta.13",
4
4
  "private": true,
5
5
  "files": [
6
6
  "wiki-*",