akm-cli 0.9.0-beta.51 → 0.9.0-beta.52

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.
@@ -48,8 +48,8 @@ empty and the caller explicitly asked for interactive ingest.
48
48
  ```sh
49
49
  akm wiki search {{WIKI_NAME}} "<key terms from the raw source>"
50
50
  ```
51
- Read the top hits with `akm show wiki:{{WIKI_NAME}}/<page>`. Use
52
- `akm show wiki:{{WIKI_NAME}}/<page> toc` for large pages.
51
+ Read the top hits with `akm show wiki:{{WIKI_NAME}}/pages/<page>`. Use
52
+ `akm show wiki:{{WIKI_NAME}}/pages/<page> toc` for large pages.
53
53
 
54
54
  4. **Decide for each candidate.** For each related page:
55
55
  - **Append**: add a section or paragraph under the relevant heading.
@@ -58,10 +58,11 @@ empty and the caller explicitly asked for interactive ingest.
58
58
  Follow the schema's contradiction policy.
59
59
  - **Skip**: source doesn't add to this page — move on.
60
60
 
61
- 5. **Create new pages for concepts/entities the source introduces.** Each
62
- new page must have frontmatter with `description`, `pageKind`,
63
- `xrefs`, and `sources`. Cross-reference with related pages both
64
- directions.
61
+ 5. **Create new pages for concepts/entities the source introduces**, under
62
+ `{{WIKI_DIR}}/pages/` (never at the wiki root only `schema.md`,
63
+ `index.md`, and `log.md` belong there). Each new page must have
64
+ frontmatter with `description`, `pageKind`, `xrefs`, and `sources`.
65
+ Cross-reference with related pages both directions.
65
66
 
66
67
  6. **Update xrefs both ways.** If page A now xrefs page B, page B must xref
67
68
  page A. `akm wiki lint {{WIKI_NAME}}` will flag violations.
@@ -8,7 +8,7 @@ wikiRole: schema
8
8
  This wiki follows the three-layer pattern:
9
9
 
10
10
  - `raw/` — immutable ingested sources (never edit)
11
- - `<page>.md` and `<topic>/<page>.md` — agent-authored pages
11
+ - `pages/<page>.md` and `pages/<topic>/<page>.md` — agent-authored pages
12
12
  - `schema.md` (this file), `index.md`, `log.md` — wiki-level metadata
13
13
 
14
14
  ## Page frontmatter
@@ -20,7 +20,7 @@ Every page should carry frontmatter so akm can index and link it:
20
20
  description: one-sentence summary used in search and lint
21
21
  pageKind: entity | concept | question | note | <your-custom-kind>
22
22
  xrefs:
23
- - wiki:{{WIKI_NAME}}/other-page
23
+ - wiki:{{WIKI_NAME}}/pages/other-page
24
24
  sources:
25
25
  - raw/<slug>.md
26
26
  ---
@@ -36,14 +36,14 @@ will surface in `index.md` as new sections after the next `akm index` run.
36
36
  1. Copy the new source into `raw/` with `akm wiki stash {{WIKI_NAME}} <path>`.
37
37
  2. Find related pages: `akm wiki search {{WIKI_NAME}} "<terms>"`.
38
38
  3. For each related page: append a section, note a contradiction, or create a
39
- new page. Update xrefs on both sides.
39
+ new page under `pages/`. Update xrefs on both sides.
40
40
  4. Cite the raw source in each touched page's `sources:` frontmatter.
41
41
  5. Append one entry to `log.md` describing what was assimilated.
42
42
 
43
43
  ### Query
44
44
 
45
45
  1. `akm wiki search {{WIKI_NAME}} "<question>"` — find candidate pages.
46
- 2. `akm show wiki:{{WIKI_NAME}}/<page>` — read the top hits.
46
+ 2. `akm show wiki:{{WIKI_NAME}}/pages/<page>` — read the top hits.
47
47
  3. Compose the answer from the wiki; cite raw sources only when the wiki
48
48
  points at them.
49
49
 
@@ -572,7 +572,7 @@ async function runSessionExtractPass(args) {
572
572
  * LLM schema repair, and returns the still-failing ref set + the repair records.
573
573
  */
574
574
  async function runValidationAndRepairPass(args) {
575
- const { postCleanupRefs, options, startMs, budgetMs } = args;
575
+ const { postCleanupRefs, options, startMs, budgetMs, primaryStashDir } = args;
576
576
  const validationFailures = [];
577
577
  for (const candidate of postCleanupRefs) {
578
578
  try {
@@ -617,7 +617,14 @@ async function runValidationAndRepairPass(args) {
617
617
  startMs,
618
618
  budgetMs,
619
619
  llmConfig: llmCfg,
620
- stashDir: options.stashDir,
620
+ // #591/#379 regression: options.stashDir is the raw, unresolved CLI
621
+ // flag (only set when --stash-dir is passed explicitly — never true
622
+ // for the scheduled tasks). primaryStashDir is the already-resolved
623
+ // source path and is what runSchemaRepairPass's `stashDir` param
624
+ // documents itself as needing ("proposal-queue writes"). Passing
625
+ // options.stashDir here made every schema-repair attempt throw
626
+ // `runSchemaRepairPass requires stashDir` on every cron invocation.
627
+ stashDir: primaryStashDir,
621
628
  findFilePath: findAssetFilePath,
622
629
  isLessonCandidateFn: isLessonCandidate,
623
630
  });
@@ -737,6 +744,7 @@ export async function runImprovePreparationStage(args) {
737
744
  options,
738
745
  startMs,
739
746
  budgetMs,
747
+ primaryStashDir,
740
748
  });
741
749
  // Phase 0.5 — structural hygiene pass
742
750
  let lintSummary;
package/dist/wiki/wiki.js CHANGED
@@ -58,6 +58,8 @@ export const SCHEMA_MD = "schema.md";
58
58
  export const INDEX_MD = "index.md";
59
59
  export const LOG_MD = "log.md";
60
60
  export const RAW_SUBDIR = "raw";
61
+ /** Canonical location for agent-authored pages, mirroring RAW_SUBDIR. */
62
+ export const PAGES_SUBDIR = "pages";
61
63
  /** Files at a wiki root that are not pages. */
62
64
  const WIKI_SPECIAL_FILES = new Set([SCHEMA_MD, INDEX_MD, LOG_MD]);
63
65
  const WIKI_NAME_RE = /^[a-z0-9][a-z0-9-]*$/;
@@ -406,18 +408,20 @@ export function createWiki(stashDir, name) {
406
408
  fs.writeFileSync(absPath, content, "utf8");
407
409
  created.push(absPath);
408
410
  }
409
- // Ensure raw/ exists with a .gitkeep so empty wikis survive clean clones.
410
- // Handle the dir-exists-but-no-.gitkeep case too (partial scaffolds,
411
+ // Ensure raw/ and pages/ exist with a .gitkeep so empty wikis survive clean
412
+ // clones. Handle the dir-exists-but-no-.gitkeep case too (partial scaffolds,
411
413
  // user-created directories) so the invariant always holds after `create`.
412
- const rawDir = path.join(wikiDir, RAW_SUBDIR);
413
- fs.mkdirSync(rawDir, { recursive: true });
414
- const gitkeepPath = path.join(rawDir, ".gitkeep");
415
- if (fs.existsSync(gitkeepPath)) {
416
- skipped.push(gitkeepPath);
417
- }
418
- else {
419
- fs.writeFileSync(gitkeepPath, "", "utf8");
420
- created.push(gitkeepPath);
414
+ for (const subdir of [RAW_SUBDIR, PAGES_SUBDIR]) {
415
+ const dir = path.join(wikiDir, subdir);
416
+ fs.mkdirSync(dir, { recursive: true });
417
+ const gitkeepPath = path.join(dir, ".gitkeep");
418
+ if (fs.existsSync(gitkeepPath)) {
419
+ skipped.push(gitkeepPath);
420
+ }
421
+ else {
422
+ fs.writeFileSync(gitkeepPath, "", "utf8");
423
+ created.push(gitkeepPath);
424
+ }
421
425
  }
422
426
  return { name, ref: `wiki:${name}`, path: wikiDir, created, skipped };
423
427
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "akm-cli",
3
- "version": "0.9.0-beta.51",
3
+ "version": "0.9.0-beta.52",
4
4
  "type": "module",
5
5
  "description": "akm (Agent Knowledge Management) — A package manager for AI agent skills, commands, tools, and knowledge. Works with Claude Code, OpenCode, Cursor, and any AI coding assistant.",
6
6
  "keywords": [