@workflow-cannon/workspace-kit 0.8.0 → 0.10.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.
Files changed (44) hide show
  1. package/README.md +21 -5
  2. package/dist/cli/run-command.d.ts +11 -0
  3. package/dist/cli/run-command.js +143 -0
  4. package/dist/cli.js +19 -146
  5. package/dist/core/config-cli.js +5 -5
  6. package/dist/core/config-metadata.js +3 -3
  7. package/dist/core/index.d.ts +1 -1
  8. package/dist/core/index.js +1 -1
  9. package/dist/core/policy.d.ts +11 -1
  10. package/dist/core/policy.js +41 -22
  11. package/dist/core/transcript-completion-hook.js +41 -3
  12. package/dist/core/workspace-kit-config.d.ts +2 -1
  13. package/dist/core/workspace-kit-config.js +4 -29
  14. package/dist/modules/approvals/index.js +2 -2
  15. package/dist/modules/documentation/runtime.js +30 -6
  16. package/dist/modules/improvement/index.js +15 -3
  17. package/dist/modules/improvement/transcript-sync-runtime.d.ts +5 -0
  18. package/dist/modules/improvement/transcript-sync-runtime.js +17 -0
  19. package/package.json +2 -1
  20. package/src/modules/documentation/README.md +39 -0
  21. package/src/modules/documentation/RULES.md +70 -0
  22. package/src/modules/documentation/config.md +14 -0
  23. package/src/modules/documentation/index.ts +120 -0
  24. package/src/modules/documentation/instructions/document-project.md +44 -0
  25. package/src/modules/documentation/instructions/documentation-maintainer.md +81 -0
  26. package/src/modules/documentation/instructions/generate-document.md +44 -0
  27. package/src/modules/documentation/runtime.ts +870 -0
  28. package/src/modules/documentation/schemas/documentation-schema.md +54 -0
  29. package/src/modules/documentation/state.md +8 -0
  30. package/src/modules/documentation/templates/AGENTS.md +84 -0
  31. package/src/modules/documentation/templates/ARCHITECTURE.md +71 -0
  32. package/src/modules/documentation/templates/PRINCIPLES.md +122 -0
  33. package/src/modules/documentation/templates/RELEASING.md +96 -0
  34. package/src/modules/documentation/templates/ROADMAP.md +131 -0
  35. package/src/modules/documentation/templates/SECURITY.md +53 -0
  36. package/src/modules/documentation/templates/SUPPORT.md +40 -0
  37. package/src/modules/documentation/templates/TERMS.md +61 -0
  38. package/src/modules/documentation/templates/runbooks/consumer-cadence.md +55 -0
  39. package/src/modules/documentation/templates/runbooks/parity-validation-flow.md +68 -0
  40. package/src/modules/documentation/templates/runbooks/release-channels.md +30 -0
  41. package/src/modules/documentation/templates/workbooks/phase2-config-policy-workbook.md +42 -0
  42. package/src/modules/documentation/templates/workbooks/task-engine-workbook.md +42 -0
  43. package/src/modules/documentation/templates/workbooks/transcript-automation-baseline.md +68 -0
  44. package/src/modules/documentation/types.ts +51 -0
@@ -0,0 +1,81 @@
1
+ meta|v=1|doc=generator|truth=canonical|st=active
2
+
3
+ goal|produce=canonical_project_docs|opt=max_obedience_per_token|minimize=ambiguity,drift,token_waste
4
+ io|in=repo_files,code_config,existing_docs,core_schema|out=manifest,rules,map,workflows,commands,decisions,glossary,observed,planned,checks
5
+ authority|order=canonical_ai_docs>code_and_config_reality>generated_human_docs>narrative_docs
6
+
7
+ use|schema=src/modules/documentation/schemas/documentation-schema.md
8
+ create|files=.ai/00-manifest.md,.ai/01-rules.md,.ai/02-map.md,.ai/03-workflows.md,.ai/04-commands.md,.ai/05-decisions.md,.ai/06-glossary.md,.ai/07-observed.md,.ai/08-planned.md,.ai/09-checks.md
9
+ min_set|files=manifest,rules,map,workflows
10
+
11
+ author|one_record_per_line=true|meta_first_once=true|stable_order=true|omit_empty_optional=true|one_fact_per_record=true|exceptions_inline=true
12
+ author|explicit=level,scope,directive,trigger,done,approval,stop_prompt_behavior
13
+ author|forbid=vague_directives,undefined_shorthand,hidden_exceptions,softened_requirements,duplicate_meaning,manual_reordering_without_reason
14
+
15
+ classify|rule=intended_policy_for_future_action
16
+ classify|observed=current_reality_or_drift_not_policy
17
+ classify|planned=target_state_not_yet_true
18
+ classify|decision=compact_choice_plus_consequence
19
+ classify|check=validation_assertion
20
+ classify|term=project_specific_term_only
21
+
22
+ infer|allowed=project_identity,stack,repo_scope,path_roles,module_roles,commands,high_confidence_workflows,observed_facts
23
+ infer|forbid=unstated_policy,hidden_exceptions,preferred_style_without_evidence,intent_from_accidental_code_smells
24
+ infer|policy_from=explicit_docs,repeated_patterns_with_high_confidence,user_stated_preferences,active_decisions
25
+ infer|when_unclear=write_observed_or_draft_not_rule
26
+
27
+ rule|write=rule|RID|lvl|scope|directive|optional_fields
28
+ rule|good=add_migration,preserve_backward_compatibility,contain_business_logic,commit_secrets,manual_edit,add_or_update_tests
29
+ rule|bad=best_practices,clean_code,good_design,keep_it_simple,do_the_right_thing
30
+ rule|levels=must,must_not,should,may
31
+ rule|scope=concrete_and_stable
32
+ rule|exception=inline_unless
33
+ rule|interaction=ov=auto,warn,prompt,stop_when_needed
34
+ rule|new_id_if=meaning_changes
35
+ rule|keep_id_if=meaning_same_and_fields_refined
36
+
37
+ map|write=path_and_module_records_only
38
+ map|path_fields=role,has,xhas,deps,xdeps,check,st,refs
39
+ map|module_fields=role,owns,deps,xdeps,entry,tests,st,refs
40
+ map|require=ownership_boundaries_for_major_paths
41
+ map|forbid=generic_roles,misc_buckets
42
+
43
+ wf|write=wf|WID|name|when|do|done|optional_fields
44
+ wf|require=trigger_and_done_when_tasklike
45
+ wf|use=forbid,ask_if,halt_if,ap,risk_when_relevant
46
+ wf|common_first=true|risky_early=true|clarify_last=true
47
+ wf|stop_if=destructive_unapproved,policy_conflict_unresolved,unsafe_missing_info
48
+ wf|ask_if=multiple_valid_interpretations,required_choice_missing
49
+
50
+ cmd|write=canonical_commands_only
51
+ cmd|include=install,dev,test,lint,build_when_present
52
+ cmd|forbid=speculative_commands
53
+
54
+ decision|write=only_active_high_value_choices
55
+ decision|require=topic,choice
56
+ decision|prefer=why,then
57
+ decision|forbid=long_narrative
58
+
59
+ term|write=only_if_reduces_ambiguity
60
+ term|forbid=common_engineering_terms,indirection_debt
61
+
62
+ observed|write=for_drift_violations_legacy_patterns_notable_current_facts
63
+ planned|write=for_target_state_not_yet_implemented
64
+ check|write=for_required_validation_gates_and_done_assertions
65
+
66
+ order|manifest=meta,project,stack,prio,truth,ref
67
+ order|rules=global,risky,scoped,workflow,style
68
+ order|map=roots,major,special,legacy
69
+ order|workflows=common,risky,edge,clarify
70
+
71
+ validate|struct=allowed_record_types,required_fields,valid_enums,valid_ids,meta_first_once
72
+ validate|semantic=no_duplicate_active_ids,no_conflicting_active_rules_without_exception,no_vague_directives,no_observed_as_rule,no_planned_as_rule,no_unknown_paths_without_reason
73
+ validate|interaction=critical_secret_risk_stop,destructive_unapproved_stop_or_required,ambiguity_prompt_or_observed
74
+
75
+ stop|if=critical_secret_risk,destructive_change_without_approval,unresolved_policy_conflict,unsafe_missing_info
76
+ prompt|if=multiple_valid_interpretations,required_approval_missing,repo_intent_unclear_but_safe_to_ask
77
+ warn|if=should_violation,low_risk_uncertainty,minor_doc_drift
78
+ auto|if=low_risk_clear_routine_work
79
+
80
+ output|deterministic=true|preserve_existing_order_when_semantics_same=true|preserve_ids=true
81
+ output|never=soften_must_to_should,drop_unless,merge_distinct_rules_into_fuzzy_prose,invent_rationale
@@ -0,0 +1,44 @@
1
+ # generate-document
2
+
3
+ Generate a single document for both canonical AI and human-readable surfaces using module config, schema, and templates.
4
+
5
+ ## Inputs
6
+
7
+ - `documentType` (required): basename of the doc to generate; must match a file under `sources.templatesRoot` (default `src/modules/documentation/templates`). Known templates:
8
+ - `AGENTS.md`
9
+ - `ARCHITECTURE.md`
10
+ - `PRINCIPLES.md`
11
+ - `RELEASING.md`
12
+ - `ROADMAP.md`
13
+ - `SECURITY.md`
14
+ - `SUPPORT.md`
15
+ - `TERMS.md`
16
+ - `runbooks/parity-validation-flow.md`
17
+ - `runbooks/consumer-cadence.md`
18
+ - `runbooks/release-channels.md`
19
+ - `workbooks/transcript-automation-baseline.md`
20
+ - `workbooks/phase2-config-policy-workbook.md`
21
+ - `workbooks/task-engine-workbook.md`
22
+ - `options`:
23
+ - `dryRun?: boolean` — compute outputs/validations without writing files
24
+ - `overwrite?: boolean` — allow replacing existing files (default `true`)
25
+ - `overwriteAi?: boolean` — override `overwrite` for AI surface only
26
+ - `overwriteHuman?: boolean` — override `overwrite` for human surface only
27
+ - `strict?: boolean` — fail on unresolved warnings (default `true`)
28
+ - `maxValidationAttempts?: number` — override retry limit
29
+ - `allowWithoutTemplate?: boolean` — continue without template only when explicitly confirmed
30
+
31
+ ## Required behavior
32
+
33
+ 1. Read `src/modules/documentation/RULES.md` and apply precedence order before generation.
34
+ 2. Load module config and resolve output roots from configured paths (`sources.aiRoot`, `sources.humanRoot`).
35
+ 3. Restrict writes strictly to configured output roots; reject writes outside those roots.
36
+ 4. Resolve template for `documentType` from `sources.templatesRoot`.
37
+ 5. If template is missing, warn user and ask whether to continue without a template; continue only on explicit confirmation.
38
+ 6. Generate AI output first at `<aiRoot>/<documentType>` using `documentation-maintainer.md` + `documentation-schema.md`.
39
+ 7. Validate AI output against schema; on validation failure, auto-resolve/retry up to `generation.maxValidationAttempts` before failing.
40
+ 8. Re-read generated AI output with project context, then generate human output at `<humanRoot>/<documentType>`.
41
+ 9. For templates containing `{{{ ... }}}`, execute block contents as generation instructions and ensure no unresolved blocks remain in output.
42
+ 10. Run section coverage validation (all required sections present, correct headings/order where required); retry/resolve on failure.
43
+ 11. Detect conflicts with higher-precedence docs and stop/prompt when policy-sensitive or unresolved.
44
+ 12. Emit run evidence: inputs, files read/written, validation results, retries used, conflict outcomes, timestamp.