@lumenflow/cli 3.1.2 → 3.1.3
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/README.md +36 -35
- package/dist/agent-issues-query.js +13 -8
- package/dist/agent-log-issue.js +15 -4
- package/dist/agent-session-end.js +15 -4
- package/dist/agent-session.js +18 -6
- package/dist/backlog-prune.js +1 -1
- package/dist/commands/integrate.js +32 -18
- package/dist/config-get.js +27 -15
- package/dist/config-set.js +104 -37
- package/dist/delegation-list.js +1 -1
- package/dist/doctor.js +19 -13
- package/dist/file-delete.js +1 -1
- package/dist/file-edit.js +1 -1
- package/dist/file-read.js +1 -1
- package/dist/file-write.js +1 -1
- package/dist/flow-bottlenecks.js +1 -1
- package/dist/flow-report.js +10 -9
- package/dist/gates.js +3 -2
- package/dist/git-branch.js +1 -1
- package/dist/git-diff.js +1 -1
- package/dist/git-log.js +1 -1
- package/dist/init.js +238 -42
- package/dist/initiative-add-wu.js +1 -1
- package/dist/initiative-bulk-assign-wus.js +1 -1
- package/dist/initiative-create.js +2 -2
- package/dist/initiative-edit.js +1 -1
- package/dist/initiative-list.js +1 -1
- package/dist/initiative-plan.js +1 -3
- package/dist/initiative-status.js +47 -6
- package/dist/lane-edit.js +19 -10
- package/dist/lane-health.js +13 -24
- package/dist/lane-lock.js +4 -5
- package/dist/lane-setup.js +5 -5
- package/dist/lane-status.js +4 -5
- package/dist/lane-suggest.js +9 -7
- package/dist/lane-validate.js +4 -5
- package/dist/lumenflow-upgrade.js +17 -11
- package/dist/mem-checkpoint.js +1 -1
- package/dist/mem-cleanup.js +6 -23
- package/dist/mem-context.js +1 -1
- package/dist/mem-create.js +1 -1
- package/dist/mem-delete.js +1 -1
- package/dist/mem-export.js +1 -1
- package/dist/mem-inbox.js +1 -1
- package/dist/mem-init.js +1 -1
- package/dist/mem-ready.js +1 -1
- package/dist/mem-recover.js +1 -1
- package/dist/mem-signal.js +1 -1
- package/dist/mem-start.js +1 -1
- package/dist/mem-summarize.js +8 -7
- package/dist/mem-triage.js +7 -5
- package/dist/metrics-cli.js +1 -1
- package/dist/metrics-snapshot.js +1 -1
- package/dist/onboard.js +295 -120
- package/dist/orchestrate-init-status.js +12 -7
- package/dist/orchestrate-initiative.js +23 -12
- package/dist/orchestrate-monitor.js +20 -8
- package/dist/pack-scaffold.js +1 -1
- package/dist/plan-create.js +1 -3
- package/dist/plan-edit.js +1 -3
- package/dist/plan-link.js +1 -3
- package/dist/plan-promote.js +1 -3
- package/dist/release.js +1 -3
- package/dist/signal-cleanup.js +4 -18
- package/dist/state-bootstrap.js +11 -8
- package/dist/state-cleanup.js +5 -19
- package/dist/state-doctor.js +213 -9
- package/dist/task-claim.js +1 -1
- package/dist/validate.js +1 -1
- package/dist/workspace-init.js +61 -61
- package/dist/wu-block.js +1 -1
- package/dist/wu-brief.js +1 -1
- package/dist/wu-claim.js +1 -1
- package/dist/wu-cleanup.js +1 -1
- package/dist/wu-create.js +3 -3
- package/dist/wu-delegate.js +1 -1
- package/dist/wu-deps.js +1 -1
- package/dist/wu-done.js +66 -34
- package/dist/wu-edit.js +1 -1
- package/dist/wu-infer-lane.js +1 -1
- package/dist/wu-preflight.js +1 -1
- package/dist/wu-prep.js +1 -1
- package/dist/wu-proto.js +1 -1
- package/dist/wu-prune.js +1 -1
- package/dist/wu-recover.js +1 -1
- package/dist/wu-release.js +1 -1
- package/dist/wu-repair.js +1 -1
- package/dist/wu-sandbox.js +40 -27
- package/dist/wu-status.js +1 -1
- package/dist/wu-unblock.js +1 -1
- package/dist/wu-unlock-lane.js +1 -1
- package/dist/wu-validate.js +1 -1
- package/package.json +12 -8
- package/packs/software-delivery/constants.ts +10 -0
- package/packs/software-delivery/extensions.ts +140 -0
- package/packs/software-delivery/gate-policies.ts +134 -0
- package/packs/software-delivery/index.ts +8 -0
- package/packs/software-delivery/manifest-schema.ts +236 -0
- package/packs/software-delivery/manifest.ts +417 -0
- package/packs/software-delivery/manifest.yaml +711 -0
- package/packs/software-delivery/pack-registration.ts +113 -0
- package/packs/software-delivery/tool-impl/agent-tools.ts +263 -0
- package/packs/software-delivery/tool-impl/delegation-tools.ts +66 -0
- package/packs/software-delivery/tool-impl/flow-metrics-tools.ts +219 -0
- package/packs/software-delivery/tool-impl/git-runner.ts +113 -0
- package/packs/software-delivery/tool-impl/git-tools.ts +316 -0
- package/packs/software-delivery/tool-impl/index.ts +15 -0
- package/packs/software-delivery/tool-impl/initiative-orchestration-tools.ts +720 -0
- package/packs/software-delivery/tool-impl/lane-lock.ts +246 -0
- package/packs/software-delivery/tool-impl/memory-tools.ts +415 -0
- package/packs/software-delivery/tool-impl/pending-runtime-tools.ts +21 -0
- package/packs/software-delivery/tool-impl/runtime-cli-adapter.ts +328 -0
- package/packs/software-delivery/tool-impl/runtime-native-tools.ts +687 -0
- package/packs/software-delivery/tool-impl/worker-loader.ts +52 -0
- package/packs/software-delivery/tool-impl/worktree-tools.ts +46 -0
- package/packs/software-delivery/tool-impl/wu-lifecycle-tools.ts +759 -0
- package/packs/software-delivery/tools/delegation-tools.ts +23 -0
- package/packs/software-delivery/tools/git-tools.ts +55 -0
- package/packs/software-delivery/tools/index.ts +8 -0
- package/packs/software-delivery/tools/lane-lock-tool.ts +37 -0
- package/packs/software-delivery/tools/types.ts +71 -0
- package/packs/software-delivery/tools/worktree-tools.ts +49 -0
- package/templates/core/LUMENFLOW.md.template +3 -3
- package/templates/core/ai/onboarding/agent-invocation-guide.md.template +1 -1
- package/templates/core/ai/onboarding/lumenflow-force-usage.md.template +1 -1
- package/templates/core/ai/onboarding/quick-ref-commands.md.template +5 -5
- package/templates/core/ai/onboarding/starting-prompt.md.template +3 -3
- package/templates/core/ai/onboarding/vendor-support.md.template +1 -1
- package/templates/core/ai/onboarding/wu-create-checklist.md.template +1 -1
- package/dist/agent-issues-query.js.map +0 -1
- package/dist/agent-log-issue.js.map +0 -1
- package/dist/agent-session-end.js.map +0 -1
- package/dist/agent-session.js.map +0 -1
- package/dist/backlog-prune.js.map +0 -1
- package/dist/cli-entry-point.js +0 -149
- package/dist/cli-entry-point.js.map +0 -1
- package/dist/commands/integrate.js.map +0 -1
- package/dist/commands.js.map +0 -1
- package/dist/config-get.js.map +0 -1
- package/dist/config-set.js.map +0 -1
- package/dist/delegation-list.js.map +0 -1
- package/dist/deps-add.js +0 -259
- package/dist/deps-add.js.map +0 -1
- package/dist/deps-remove.js +0 -105
- package/dist/deps-remove.js.map +0 -1
- package/dist/docs-sync.js.map +0 -1
- package/dist/doctor.js.map +0 -1
- package/dist/file-delete.js.map +0 -1
- package/dist/file-edit.js.map +0 -1
- package/dist/file-read.js.map +0 -1
- package/dist/file-write.js.map +0 -1
- package/dist/flow-bottlenecks.js.map +0 -1
- package/dist/flow-report.js.map +0 -1
- package/dist/formatters.js +0 -151
- package/dist/formatters.js.map +0 -1
- package/dist/gate-defaults.js +0 -131
- package/dist/gate-defaults.js.map +0 -1
- package/dist/gate-registry.js +0 -73
- package/dist/gate-registry.js.map +0 -1
- package/dist/gates-graceful-degradation.js +0 -153
- package/dist/gates-graceful-degradation.js.map +0 -1
- package/dist/gates-plan-resolvers.js +0 -152
- package/dist/gates-plan-resolvers.js.map +0 -1
- package/dist/gates-runners.js +0 -509
- package/dist/gates-runners.js.map +0 -1
- package/dist/gates-types.js +0 -4
- package/dist/gates-types.js.map +0 -1
- package/dist/gates-utils.js +0 -323
- package/dist/gates-utils.js.map +0 -1
- package/dist/gates.js.map +0 -1
- package/dist/git-branch.js.map +0 -1
- package/dist/git-diff.js.map +0 -1
- package/dist/git-log.js.map +0 -1
- package/dist/git-status.js.map +0 -1
- package/dist/guard-locked.js +0 -172
- package/dist/guard-locked.js.map +0 -1
- package/dist/guard-main-branch.js +0 -217
- package/dist/guard-main-branch.js.map +0 -1
- package/dist/guard-worktree-commit.js +0 -163
- package/dist/guard-worktree-commit.js.map +0 -1
- package/dist/hooks/auto-checkpoint-utils.js +0 -54
- package/dist/hooks/auto-checkpoint-utils.js.map +0 -1
- package/dist/hooks/enforcement-checks.js +0 -399
- package/dist/hooks/enforcement-checks.js.map +0 -1
- package/dist/hooks/enforcement-generator.js +0 -139
- package/dist/hooks/enforcement-generator.js.map +0 -1
- package/dist/hooks/enforcement-sync.js +0 -385
- package/dist/hooks/enforcement-sync.js.map +0 -1
- package/dist/hooks/generators/auto-checkpoint.js +0 -125
- package/dist/hooks/generators/auto-checkpoint.js.map +0 -1
- package/dist/hooks/generators/enforce-worktree.js +0 -190
- package/dist/hooks/generators/enforce-worktree.js.map +0 -1
- package/dist/hooks/generators/index.js +0 -18
- package/dist/hooks/generators/index.js.map +0 -1
- package/dist/hooks/generators/pre-compact-checkpoint.js +0 -136
- package/dist/hooks/generators/pre-compact-checkpoint.js.map +0 -1
- package/dist/hooks/generators/require-wu.js +0 -117
- package/dist/hooks/generators/require-wu.js.map +0 -1
- package/dist/hooks/generators/session-start-recovery.js +0 -103
- package/dist/hooks/generators/session-start-recovery.js.map +0 -1
- package/dist/hooks/generators/signal-utils.js +0 -54
- package/dist/hooks/generators/signal-utils.js.map +0 -1
- package/dist/hooks/generators/warn-incomplete.js +0 -67
- package/dist/hooks/generators/warn-incomplete.js.map +0 -1
- package/dist/hooks/index.js +0 -10
- package/dist/hooks/index.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/init-detection.js +0 -232
- package/dist/init-detection.js.map +0 -1
- package/dist/init-lane-validation.js +0 -143
- package/dist/init-lane-validation.js.map +0 -1
- package/dist/init-scaffolding.js +0 -158
- package/dist/init-scaffolding.js.map +0 -1
- package/dist/init-templates.js +0 -1982
- package/dist/init-templates.js.map +0 -1
- package/dist/init.js.map +0 -1
- package/dist/initiative-add-wu.js.map +0 -1
- package/dist/initiative-bulk-assign-wus.js.map +0 -1
- package/dist/initiative-create.js.map +0 -1
- package/dist/initiative-edit.js.map +0 -1
- package/dist/initiative-list.js.map +0 -1
- package/dist/initiative-plan.js.map +0 -1
- package/dist/initiative-remove-wu.js.map +0 -1
- package/dist/initiative-status.js.map +0 -1
- package/dist/lane-edit.js.map +0 -1
- package/dist/lane-health.js.map +0 -1
- package/dist/lane-lifecycle-process.js +0 -366
- package/dist/lane-lifecycle-process.js.map +0 -1
- package/dist/lane-lock.js.map +0 -1
- package/dist/lane-setup.js.map +0 -1
- package/dist/lane-status.js.map +0 -1
- package/dist/lane-suggest.js.map +0 -1
- package/dist/lane-validate.js.map +0 -1
- package/dist/lifecycle-regression-harness.js +0 -181
- package/dist/lifecycle-regression-harness.js.map +0 -1
- package/dist/lumenflow-upgrade.js.map +0 -1
- package/dist/mem-checkpoint.js.map +0 -1
- package/dist/mem-cleanup.js.map +0 -1
- package/dist/mem-context.js.map +0 -1
- package/dist/mem-create.js.map +0 -1
- package/dist/mem-delete.js.map +0 -1
- package/dist/mem-export.js.map +0 -1
- package/dist/mem-inbox.js.map +0 -1
- package/dist/mem-index.js +0 -214
- package/dist/mem-index.js.map +0 -1
- package/dist/mem-init.js.map +0 -1
- package/dist/mem-profile.js +0 -210
- package/dist/mem-profile.js.map +0 -1
- package/dist/mem-promote.js +0 -257
- package/dist/mem-promote.js.map +0 -1
- package/dist/mem-ready.js.map +0 -1
- package/dist/mem-recover.js.map +0 -1
- package/dist/mem-signal.js.map +0 -1
- package/dist/mem-start.js.map +0 -1
- package/dist/mem-summarize.js.map +0 -1
- package/dist/mem-triage.js.map +0 -1
- package/dist/merge-block.js +0 -225
- package/dist/merge-block.js.map +0 -1
- package/dist/metrics-cli.js.map +0 -1
- package/dist/metrics-snapshot.js.map +0 -1
- package/dist/onboard.js.map +0 -1
- package/dist/onboarding-smoke-test.js +0 -418
- package/dist/onboarding-smoke-test.js.map +0 -1
- package/dist/orchestrate-init-status.js.map +0 -1
- package/dist/orchestrate-initiative.js.map +0 -1
- package/dist/orchestrate-monitor.js.map +0 -1
- package/dist/pack-author.js.map +0 -1
- package/dist/pack-hash.js.map +0 -1
- package/dist/pack-install.js.map +0 -1
- package/dist/pack-publish.js.map +0 -1
- package/dist/pack-scaffold.js.map +0 -1
- package/dist/pack-search.js.map +0 -1
- package/dist/pack-validate.js.map +0 -1
- package/dist/plan-create.js.map +0 -1
- package/dist/plan-edit.js.map +0 -1
- package/dist/plan-link.js.map +0 -1
- package/dist/plan-promote.js.map +0 -1
- package/dist/public-manifest.js +0 -920
- package/dist/public-manifest.js.map +0 -1
- package/dist/release.js.map +0 -1
- package/dist/rotate-progress.js +0 -253
- package/dist/rotate-progress.js.map +0 -1
- package/dist/session-coordinator.js +0 -303
- package/dist/session-coordinator.js.map +0 -1
- package/dist/shared-validators.js +0 -81
- package/dist/shared-validators.js.map +0 -1
- package/dist/signal-cleanup.js.map +0 -1
- package/dist/state-bootstrap.js.map +0 -1
- package/dist/state-cleanup.js.map +0 -1
- package/dist/state-doctor-fix.js +0 -226
- package/dist/state-doctor-fix.js.map +0 -1
- package/dist/state-doctor-stamps.js +0 -23
- package/dist/state-doctor-stamps.js.map +0 -1
- package/dist/state-doctor.js.map +0 -1
- package/dist/strict-progress.js +0 -255
- package/dist/strict-progress.js.map +0 -1
- package/dist/sync-templates.js.map +0 -1
- package/dist/task-claim.js.map +0 -1
- package/dist/trace-gen.js +0 -401
- package/dist/trace-gen.js.map +0 -1
- package/dist/validate-agent-skills.js +0 -223
- package/dist/validate-agent-skills.js.map +0 -1
- package/dist/validate-agent-sync.js +0 -151
- package/dist/validate-agent-sync.js.map +0 -1
- package/dist/validate-backlog-sync.js +0 -77
- package/dist/validate-backlog-sync.js.map +0 -1
- package/dist/validate-skills-spec.js +0 -211
- package/dist/validate-skills-spec.js.map +0 -1
- package/dist/validate.js.map +0 -1
- package/dist/validator-defaults.js +0 -107
- package/dist/validator-defaults.js.map +0 -1
- package/dist/validator-registry.js +0 -71
- package/dist/validator-registry.js.map +0 -1
- package/dist/workspace-init.js.map +0 -1
- package/dist/wu-block.js.map +0 -1
- package/dist/wu-brief.js.map +0 -1
- package/dist/wu-claim-branch.js +0 -123
- package/dist/wu-claim-branch.js.map +0 -1
- package/dist/wu-claim-cloud.js +0 -79
- package/dist/wu-claim-cloud.js.map +0 -1
- package/dist/wu-claim-mode.js +0 -82
- package/dist/wu-claim-mode.js.map +0 -1
- package/dist/wu-claim-output.js +0 -85
- package/dist/wu-claim-output.js.map +0 -1
- package/dist/wu-claim-repair-guidance.js +0 -12
- package/dist/wu-claim-repair-guidance.js.map +0 -1
- package/dist/wu-claim-resume-handler.js +0 -87
- package/dist/wu-claim-resume-handler.js.map +0 -1
- package/dist/wu-claim-state.js +0 -581
- package/dist/wu-claim-state.js.map +0 -1
- package/dist/wu-claim-validation.js +0 -457
- package/dist/wu-claim-validation.js.map +0 -1
- package/dist/wu-claim-worktree.js +0 -223
- package/dist/wu-claim-worktree.js.map +0 -1
- package/dist/wu-claim.js.map +0 -1
- package/dist/wu-cleanup-cloud.js +0 -78
- package/dist/wu-cleanup-cloud.js.map +0 -1
- package/dist/wu-cleanup.js.map +0 -1
- package/dist/wu-code-path-coverage.js +0 -83
- package/dist/wu-code-path-coverage.js.map +0 -1
- package/dist/wu-create-cloud.js +0 -30
- package/dist/wu-create-cloud.js.map +0 -1
- package/dist/wu-create-content.js +0 -264
- package/dist/wu-create-content.js.map +0 -1
- package/dist/wu-create-readiness.js +0 -59
- package/dist/wu-create-readiness.js.map +0 -1
- package/dist/wu-create-validation.js +0 -128
- package/dist/wu-create-validation.js.map +0 -1
- package/dist/wu-create.js.map +0 -1
- package/dist/wu-delegate.js.map +0 -1
- package/dist/wu-delete.js.map +0 -1
- package/dist/wu-deps.js.map +0 -1
- package/dist/wu-done-auto-cleanup.js +0 -203
- package/dist/wu-done-auto-cleanup.js.map +0 -1
- package/dist/wu-done-check.js +0 -38
- package/dist/wu-done-check.js.map +0 -1
- package/dist/wu-done-cloud.js +0 -48
- package/dist/wu-done-cloud.js.map +0 -1
- package/dist/wu-done-decay.js +0 -86
- package/dist/wu-done-decay.js.map +0 -1
- package/dist/wu-done.js.map +0 -1
- package/dist/wu-edit-operations.js +0 -399
- package/dist/wu-edit-operations.js.map +0 -1
- package/dist/wu-edit-validators.js +0 -282
- package/dist/wu-edit-validators.js.map +0 -1
- package/dist/wu-edit.js.map +0 -1
- package/dist/wu-infer-lane.js.map +0 -1
- package/dist/wu-preflight.js.map +0 -1
- package/dist/wu-prep.js.map +0 -1
- package/dist/wu-proto.js.map +0 -1
- package/dist/wu-prune.js.map +0 -1
- package/dist/wu-recover.js.map +0 -1
- package/dist/wu-release.js.map +0 -1
- package/dist/wu-repair.js.map +0 -1
- package/dist/wu-sandbox.js.map +0 -1
- package/dist/wu-spawn-completion.js +0 -33
- package/dist/wu-spawn-completion.js.map +0 -1
- package/dist/wu-spawn-prompt-builders.js +0 -1197
- package/dist/wu-spawn-prompt-builders.js.map +0 -1
- package/dist/wu-spawn-strategy-resolver.js +0 -322
- package/dist/wu-spawn-strategy-resolver.js.map +0 -1
- package/dist/wu-spawn.js +0 -59
- package/dist/wu-spawn.js.map +0 -1
- package/dist/wu-state-cloud.js +0 -41
- package/dist/wu-state-cloud.js.map +0 -1
- package/dist/wu-status.js.map +0 -1
- package/dist/wu-unblock.js.map +0 -1
- package/dist/wu-unlock-lane.js.map +0 -1
- package/dist/wu-validate.js.map +0 -1
package/dist/init-templates.js
DELETED
|
@@ -1,1982 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2026 Hellmai Ltd
|
|
2
|
-
// SPDX-License-Identifier: AGPL-3.0-only
|
|
3
|
-
/**
|
|
4
|
-
* @file init-templates.ts
|
|
5
|
-
* Template string constants for LumenFlow project scaffolding.
|
|
6
|
-
*
|
|
7
|
-
* Extracted from init.ts (WU-1643) to reduce file size and isolate static data.
|
|
8
|
-
* These are pure data constants with no behavioral logic.
|
|
9
|
-
*/
|
|
10
|
-
// WU-1576: Lane definitions must have zero overlapping code_paths.
|
|
11
|
-
// Each path must appear in exactly one lane to avoid doctor warnings.
|
|
12
|
-
export const DEFAULT_LANE_DEFINITIONS = [
|
|
13
|
-
{
|
|
14
|
-
name: 'Framework: Core',
|
|
15
|
-
wip_limit: 1,
|
|
16
|
-
code_paths: ['packages/**/core/**', 'src/core/**', 'lib/**'],
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
name: 'Framework: CLI',
|
|
20
|
-
wip_limit: 1,
|
|
21
|
-
code_paths: ['packages/**/cli/**', 'src/cli/**', 'bin/**'],
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
name: 'Experience: Web',
|
|
25
|
-
wip_limit: 1,
|
|
26
|
-
code_paths: ['apps/web/**', 'web/**', 'src/components/**', 'src/pages/**', 'src/app/**'],
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
name: 'Operations: Infrastructure',
|
|
30
|
-
wip_limit: 1,
|
|
31
|
-
code_paths: ['infrastructure/**', 'deploy/**'],
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
name: 'Operations: CI/CD',
|
|
35
|
-
wip_limit: 1,
|
|
36
|
-
code_paths: ['.github/workflows/**', '.github/actions/**', '.circleci/**'],
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
name: 'Content: Documentation',
|
|
40
|
-
wip_limit: 1,
|
|
41
|
-
code_paths: ['docs/**', '*.md'],
|
|
42
|
-
},
|
|
43
|
-
];
|
|
44
|
-
// WU-1171: Template for AGENTS.md (universal entry point)
|
|
45
|
-
// WU-1300: Updated quick-ref link to correct path
|
|
46
|
-
// WU-1309: Use {{QUICK_REF_LINK}} and <project-root> placeholder for portability
|
|
47
|
-
export const AGENTS_MD_TEMPLATE = `# Universal Agent Instructions
|
|
48
|
-
|
|
49
|
-
**Last updated:** {{DATE}}
|
|
50
|
-
|
|
51
|
-
This project uses LumenFlow workflow. For complete documentation, see [LUMENFLOW.md](LUMENFLOW.md).
|
|
52
|
-
|
|
53
|
-
---
|
|
54
|
-
|
|
55
|
-
## Quick Start
|
|
56
|
-
|
|
57
|
-
\`\`\`bash
|
|
58
|
-
# First-time lane setup (once per project)
|
|
59
|
-
pnpm lane:setup
|
|
60
|
-
pnpm lane:validate
|
|
61
|
-
pnpm lane:lock
|
|
62
|
-
\`\`\`
|
|
63
|
-
|
|
64
|
-
\`\`\`bash
|
|
65
|
-
# 1. Claim a WU
|
|
66
|
-
pnpm wu:claim --id WU-XXXX --lane <Lane>
|
|
67
|
-
cd worktrees/<lane>-wu-xxxx
|
|
68
|
-
|
|
69
|
-
# 2. Work in worktree, run gates
|
|
70
|
-
pnpm gates
|
|
71
|
-
|
|
72
|
-
# 3. Complete (ALWAYS run this!)
|
|
73
|
-
cd <project-root>
|
|
74
|
-
pnpm wu:done --id WU-XXXX
|
|
75
|
-
\`\`\`
|
|
76
|
-
|
|
77
|
-
> **Complete CLI reference:** See [quick-ref-commands.md]({{QUICK_REF_LINK}})
|
|
78
|
-
|
|
79
|
-
---
|
|
80
|
-
|
|
81
|
-
## Critical: Always wu:done
|
|
82
|
-
|
|
83
|
-
After completing work, ALWAYS run \`pnpm wu:done --id WU-XXXX\` from the main checkout.
|
|
84
|
-
|
|
85
|
-
This is the single most forgotten step. See [LUMENFLOW.md](LUMENFLOW.md) for details.
|
|
86
|
-
|
|
87
|
-
---
|
|
88
|
-
|
|
89
|
-
## Core Principles
|
|
90
|
-
|
|
91
|
-
1. **TDD**: Write tests first, then implementation
|
|
92
|
-
2. **Worktree Discipline**: After \`wu:claim\`, work ONLY in the worktree
|
|
93
|
-
3. **Gates Before Done**: Run \`pnpm gates\` before \`wu:done\`
|
|
94
|
-
4. **Never Bypass Hooks**: No \`--no-verify\`
|
|
95
|
-
|
|
96
|
-
---
|
|
97
|
-
|
|
98
|
-
## Forbidden Commands
|
|
99
|
-
|
|
100
|
-
- \`git reset --hard\`
|
|
101
|
-
- \`git push --force\`
|
|
102
|
-
- \`git stash\` (on main)
|
|
103
|
-
- \`--no-verify\`
|
|
104
|
-
|
|
105
|
-
---
|
|
106
|
-
|
|
107
|
-
## Vendor-Specific Overlays
|
|
108
|
-
|
|
109
|
-
This file provides universal guidance for all AI agents. Additional vendor-specific configuration:
|
|
110
|
-
|
|
111
|
-
- **Claude Code**: See \`CLAUDE.md\` (if present)
|
|
112
|
-
- **Cursor**: See \`.cursor/rules/lumenflow.md\` (if present)
|
|
113
|
-
- **Windsurf**: See \`.windsurf/rules/lumenflow.md\` (if present)
|
|
114
|
-
`;
|
|
115
|
-
// Template for LUMENFLOW.md (main entry point)
|
|
116
|
-
// WU-1309: Use <project-root> placeholder for portability
|
|
117
|
-
// WU-1364: Added initiative workflow section
|
|
118
|
-
export const LUMENFLOW_MD_TEMPLATE = `# LumenFlow Workflow Guide\n\n**Last updated:** {{DATE}}\n\nLumenFlow is a vendor-agnostic workflow framework for AI-native software development.\n\n---\n\n## Critical Rule: ALWAYS Run wu:done\n\n**After completing work on a WU, you MUST run \`pnpm wu:done --id WU-XXXX\` from the main checkout.**\n\nThis is the single most forgotten step. Do NOT:\n- Write "To Complete: pnpm wu:done" and stop\n- Ask if you should run wu:done\n- Forget to run wu:done\n\n**DO**: Run \`pnpm wu:done --id WU-XXXX\` immediately after gates pass.\n\n---\n\n## When to Use Initiatives\n\nUse **Initiatives** for multi-phase work spanning multiple WUs:\n\n- **Product visions**: "Build a task management app"\n- **Larger features**: Work requiring multiple WUs across lanes\n- **Complex projects**: Anything that needs phased delivery\n\n\`\`\`bash\n# Create an initiative for multi-phase work\npnpm initiative:create --id INIT-001 --title "Feature Name" \\\\\n --description "..." --phase "Phase 1: MVP" --phase "Phase 2: Polish"\n\n# Add WUs to the initiative\npnpm initiative:add-wu --initiative INIT-001 --wu WU-XXX --phase 1\n\n# Track progress\npnpm initiative:status --id INIT-001\n\`\`\`\n\n**Skip initiatives** for: single-file bug fixes, small docs updates, isolated refactoring.\n\n---\n\n## Quick Start\n\n\`\`\`bash\n# 1. Configure lanes (once per project)\npnpm lane:setup\npnpm lane:validate\npnpm lane:lock\n\n# 2. Create a WU\npnpm wu:create --id WU-XXXX --lane <Lane> --title "Title"\n\n# 3. Edit WU spec with acceptance criteria, then claim:\npnpm wu:claim --id WU-XXXX --lane <Lane>\ncd worktrees/<lane>-wu-xxxx\n\n# 4. Implement in worktree\n\n# 5. Run gates\npnpm gates --docs-only # for docs changes\npnpm gates # for code changes\n\n# 6. Complete (from main checkout)\ncd <project-root>\npnpm wu:done --id WU-XXXX\n\`\`\`\n\n---\n\n## Core Principles\n\n1. **TDD**: Failing test -> implementation -> passing test (>=90% coverage on new code)\n2. **Library-First**: Search existing libraries before custom code\n3. **DRY/SOLID/KISS/YAGNI**: No magic numbers, no hardcoded strings\n4. **Worktree Discipline**: After \`wu:claim\`, work ONLY in the worktree\n5. **Gates Before Done**: All gates must pass before \`wu:done\`\n6. **Do Not Bypass Hooks**: No \`--no-verify\`, fix issues properly\n7. **Always wu:done**: Complete every WU by running \`pnpm wu:done\`\n\n---\n\n## Documentation Structure\n\n### Core (Vendor-Agnostic)\n\n- **LUMENFLOW.md** - This file, main entry point\n- **.lumenflow/constraints.md** - Non-negotiable workflow constraints\n- **.lumenflow/agents/** - Agent instructions (vendor-agnostic)\n- **.lumenflow.config.yaml** - Workflow configuration\n\n### Optional Overlays\n\n- **CLAUDE.md + .claude/agents/** - Claude Code overlay (auto if Claude Code detected)\n- **{{DOCS_TASKS_PATH}}** - Task boards and WU storage (\`lumenflow init --full\`)\n- **{{DOCS_ONBOARDING_PATH}}** - Agent onboarding docs\n- **.lumenflow.framework.yaml** - Framework hint file (created with \`--framework\`)\n\n---\n\n## Worktree Discipline (IMMUTABLE LAW)\n\nAfter claiming a WU, you MUST work in its worktree:\n\n\`\`\`bash\n# 1. Claim creates worktree\npnpm wu:claim --id WU-XXX --lane <lane>\n\n# 2. IMMEDIATELY cd to worktree\ncd worktrees/<lane>-wu-xxx\n\n# 3. ALL work happens here\n\n# 4. Return to main ONLY to complete\ncd <project-root>\npnpm wu:done --id WU-XXX\n\`\`\`\n\n---\n\n## Definition of Done\n\n- Acceptance criteria satisfied\n- Gates green (\`pnpm gates\` or \`pnpm gates --docs-only\`)\n- WU YAML status = \`done\`\n- \`wu:done\` has been run\n\n---\n\n## Commands Reference\n\n| Command | Description |\n| ----------------- | ----------------------------------- |\n| \`pnpm lane:status\` | Show lane lifecycle status |\n| \`pnpm lane:setup\` | Create/update draft lane artifacts |\n| \`pnpm lane:lock\` | Lock lane lifecycle for WU creation |\n| \`pnpm wu:create\` | Create new WU spec |\n| \`pnpm wu:claim\` | Claim WU and create worktree |\n| \`pnpm wu:done\` | Complete WU (merge, stamp, cleanup) |\n| \`pnpm gates\` | Run quality gates |\n| \`pnpm initiative:create\` | Create multi-phase initiative |\n| \`pnpm initiative:status\` | View initiative progress |\n\n---\n\n## Constraints\n\nSee [.lumenflow/constraints.md](.lumenflow/constraints.md) for the 6 non-negotiable rules.\n\n---\n\n## Agent Onboarding\n\n- Start with **CLAUDE.md** if present (Claude Code overlay).\n- Add vendor-agnostic guidance in **.lumenflow/agents/**.\n- Check the onboarding docs in **{{DOCS_ONBOARDING_PATH}}** for detailed guidance.\n`;
|
|
119
|
-
// Template for .lumenflow/constraints.md
|
|
120
|
-
export const CONSTRAINTS_MD_TEMPLATE = `# LumenFlow Constraints Capsule\n\n**Version:** 1.0\n**Last updated:** {{DATE}}\n\n## The 6 Non-Negotiable Constraints\n\n### 1. Worktree Discipline and Git Safety\nWork only in worktrees, treat main as read-only, never run destructive git commands on main.\n\n### 2. WUs Are Specs, Not Code\nRespect code_paths boundaries, no feature creep, no code blocks in WU YAML files.\n\n### 3. Docs-Only vs Code WUs\nDocumentation WUs use \`--docs-only\` gates, code WUs run full gates.\n\n### 4. LLM-First, Zero-Fallback Inference\nUse LLMs for semantic tasks, fall back to safe defaults (never regex/keywords).\n\n### 5. Gates and Skip-Gates\nComplete via \`pnpm wu:done\`; skip-gates only for pre-existing failures with \`--reason\` and \`--fix-wu\`.\n\n### 6. Safety and Governance\nRespect privacy rules, approved sources, security policies; when uncertain, choose safer path.\n\n---\n\n## Mini Audit Checklist\n\nBefore running \`wu:done\`, verify:\n\n- [ ] Working in worktree (not main)\n- [ ] Only modified files in \`code_paths\`\n- [ ] Gates pass\n- [ ] No forbidden git commands used\n- [ ] Acceptance criteria satisfied\n\n---\n\n## Escalation Triggers\n\nStop and ask a human when:\n- Same error repeats 3 times\n- Auth or permissions changes required\n- PII/safety issues discovered\n- Cloud spend or secrets involved\n`;
|
|
121
|
-
// Template for root CLAUDE.md
|
|
122
|
-
// WU-1309: Use <project-root> placeholder for portability
|
|
123
|
-
// WU-1382: Expanded with CLI commands table and warning about manual YAML editing
|
|
124
|
-
export const CLAUDE_MD_TEMPLATE = `# Claude Code Instructions
|
|
125
|
-
|
|
126
|
-
**Last updated:** {{DATE}}
|
|
127
|
-
|
|
128
|
-
This project uses LumenFlow workflow. For workflow documentation, see [LUMENFLOW.md](LUMENFLOW.md).
|
|
129
|
-
|
|
130
|
-
---
|
|
131
|
-
|
|
132
|
-
## Quick Start
|
|
133
|
-
|
|
134
|
-
\`\`\`bash
|
|
135
|
-
# 1. Claim a WU
|
|
136
|
-
pnpm wu:claim --id WU-XXXX --lane <Lane>
|
|
137
|
-
cd worktrees/<lane>-wu-xxxx
|
|
138
|
-
|
|
139
|
-
# 2. Work in worktree, run gates
|
|
140
|
-
pnpm gates
|
|
141
|
-
|
|
142
|
-
# 3. Complete (ALWAYS run this!)
|
|
143
|
-
cd <project-root>
|
|
144
|
-
pnpm wu:done --id WU-XXXX
|
|
145
|
-
\`\`\`
|
|
146
|
-
|
|
147
|
-
---
|
|
148
|
-
|
|
149
|
-
## CLI Commands Reference
|
|
150
|
-
|
|
151
|
-
### WU Lifecycle
|
|
152
|
-
|
|
153
|
-
| Command | Description |
|
|
154
|
-
| ----------------------------------------- | ---------------------------------------- |
|
|
155
|
-
| \`pnpm wu:status --id WU-XXX\` | Show WU status, location, valid commands |
|
|
156
|
-
| \`pnpm wu:claim --id WU-XXX --lane <Lane>\` | Claim WU and create worktree |
|
|
157
|
-
| \`pnpm wu:prep --id WU-XXX\` | Run gates in worktree, prep for wu:done |
|
|
158
|
-
| \`pnpm wu:done --id WU-XXX\` | Complete WU (from main checkout) |
|
|
159
|
-
| \`pnpm wu:block --id WU-XXX --reason "..."\`| Block WU with reason |
|
|
160
|
-
| \`pnpm wu:unblock --id WU-XXX\` | Unblock WU |
|
|
161
|
-
|
|
162
|
-
### Gates & Quality
|
|
163
|
-
|
|
164
|
-
| Command | Description |
|
|
165
|
-
| ------------------------ | -------------------------- |
|
|
166
|
-
| \`pnpm gates\` | Run all quality gates |
|
|
167
|
-
| \`pnpm gates --docs-only\` | Run gates for docs changes |
|
|
168
|
-
| \`pnpm format\` | Format all files |
|
|
169
|
-
| \`pnpm lint\` | Run linter |
|
|
170
|
-
| \`pnpm typecheck\` | Run TypeScript check |
|
|
171
|
-
| \`pnpm test\` | Run tests |
|
|
172
|
-
|
|
173
|
-
---
|
|
174
|
-
|
|
175
|
-
## Critical: Always wu:done
|
|
176
|
-
|
|
177
|
-
After completing work, ALWAYS run \`pnpm wu:done --id WU-XXXX\` from the main checkout.
|
|
178
|
-
|
|
179
|
-
See [LUMENFLOW.md](LUMENFLOW.md) for full workflow documentation.
|
|
180
|
-
|
|
181
|
-
---
|
|
182
|
-
|
|
183
|
-
## Warning: Do Not Edit WU YAML Files Manually
|
|
184
|
-
|
|
185
|
-
**Never manually edit WU YAML files** in \`docs/.../tasks/wu/WU-XXX.yaml\`.
|
|
186
|
-
|
|
187
|
-
Use CLI commands instead:
|
|
188
|
-
|
|
189
|
-
- \`pnpm wu:create ...\` to create new WUs
|
|
190
|
-
- \`pnpm wu:edit --id WU-XXX ...\` to modify WU fields
|
|
191
|
-
- \`pnpm wu:claim\` / \`wu:block\` / \`wu:done\` for status changes
|
|
192
|
-
|
|
193
|
-
Manual edits bypass validation and can corrupt workflow state.
|
|
194
|
-
`;
|
|
195
|
-
// Template for .claude/settings.json
|
|
196
|
-
export const CLAUDE_SETTINGS_TEMPLATE = `{
|
|
197
|
-
"$schema": "https://json.schemastore.org/claude-code-settings.json",
|
|
198
|
-
"permissions": {
|
|
199
|
-
"allow": [
|
|
200
|
-
"Bash",
|
|
201
|
-
"Read",
|
|
202
|
-
"Write",
|
|
203
|
-
"Edit",
|
|
204
|
-
"WebFetch",
|
|
205
|
-
"WebSearch"
|
|
206
|
-
],
|
|
207
|
-
"deny": [
|
|
208
|
-
"Read(./.env)",
|
|
209
|
-
"Read(./.env.*)",
|
|
210
|
-
"Write(./.env*)",
|
|
211
|
-
"Bash(git reset --hard *)",
|
|
212
|
-
"Bash(git stash *)",
|
|
213
|
-
"Bash(git clean -fd *)",
|
|
214
|
-
"Bash(git push --force *)",
|
|
215
|
-
"Bash(git push -f *)",
|
|
216
|
-
"Bash(git commit --no-verify *)",
|
|
217
|
-
"Bash(HUSKY=0 *)",
|
|
218
|
-
"Bash(rm -rf /*)",
|
|
219
|
-
"Bash(sudo *)",
|
|
220
|
-
"Bash(git worktree remove *)",
|
|
221
|
-
"Bash(git worktree prune *)"
|
|
222
|
-
]
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
`;
|
|
226
|
-
// WU-1171: Template for .cursor/rules/lumenflow.md (updated path)
|
|
227
|
-
// WU-1309: Use <project-root> placeholder for portability
|
|
228
|
-
export const CURSOR_RULES_TEMPLATE = `# Cursor LumenFlow Rules
|
|
229
|
-
|
|
230
|
-
This project uses LumenFlow workflow. See [LUMENFLOW.md](../../LUMENFLOW.md).
|
|
231
|
-
|
|
232
|
-
## Critical Rules
|
|
233
|
-
|
|
234
|
-
1. **Always run wu:done** - After gates pass, run \`pnpm wu:done --id WU-XXX\`
|
|
235
|
-
2. **Work in worktrees** - After \`wu:claim\`, work only in the worktree
|
|
236
|
-
3. **Never bypass hooks** - No \`--no-verify\`
|
|
237
|
-
4. **TDD** - Write tests first
|
|
238
|
-
|
|
239
|
-
## Forbidden Commands
|
|
240
|
-
|
|
241
|
-
- \`git reset --hard\`
|
|
242
|
-
- \`git push --force\`
|
|
243
|
-
- \`git stash\` (on main)
|
|
244
|
-
- \`--no-verify\`
|
|
245
|
-
|
|
246
|
-
## Quick Reference
|
|
247
|
-
|
|
248
|
-
\`\`\`bash
|
|
249
|
-
# Claim WU
|
|
250
|
-
pnpm wu:claim --id WU-XXX --lane <Lane>
|
|
251
|
-
cd worktrees/<lane>-wu-xxx
|
|
252
|
-
|
|
253
|
-
# Run gates
|
|
254
|
-
pnpm gates
|
|
255
|
-
|
|
256
|
-
# Complete (from main)
|
|
257
|
-
cd <project-root>
|
|
258
|
-
pnpm wu:done --id WU-XXX
|
|
259
|
-
\`\`\`
|
|
260
|
-
`;
|
|
261
|
-
// WU-1171: Template for .windsurf/rules/lumenflow.md
|
|
262
|
-
// WU-1309: Use <project-root> placeholder for portability
|
|
263
|
-
export const WINDSURF_RULES_TEMPLATE = `# Windsurf LumenFlow Rules
|
|
264
|
-
|
|
265
|
-
This project uses LumenFlow workflow. See [LUMENFLOW.md](../../LUMENFLOW.md).
|
|
266
|
-
|
|
267
|
-
## Critical Rules
|
|
268
|
-
|
|
269
|
-
1. **Always run wu:done** - After gates pass, run \`pnpm wu:done --id WU-XXX\`
|
|
270
|
-
2. **Work in worktrees** - After \`wu:claim\`, work only in the worktree
|
|
271
|
-
3. **Never bypass hooks** - No \`--no-verify\`
|
|
272
|
-
4. **TDD** - Write tests first
|
|
273
|
-
|
|
274
|
-
## Forbidden Commands
|
|
275
|
-
|
|
276
|
-
- \`git reset --hard\`
|
|
277
|
-
- \`git push --force\`
|
|
278
|
-
- \`git stash\` (on main)
|
|
279
|
-
- \`--no-verify\`
|
|
280
|
-
|
|
281
|
-
## Quick Reference
|
|
282
|
-
|
|
283
|
-
\`\`\`bash
|
|
284
|
-
# Claim WU
|
|
285
|
-
pnpm wu:claim --id WU-XXX --lane <Lane>
|
|
286
|
-
cd worktrees/<lane>-wu-xxx
|
|
287
|
-
|
|
288
|
-
# Run gates
|
|
289
|
-
pnpm gates
|
|
290
|
-
|
|
291
|
-
# Complete (from main)
|
|
292
|
-
cd <project-root>
|
|
293
|
-
pnpm wu:done --id WU-XXX
|
|
294
|
-
\`\`\`
|
|
295
|
-
`;
|
|
296
|
-
// WU-1177: Template for .clinerules (Cline AI assistant)
|
|
297
|
-
// WU-1309: Use <project-root> placeholder for portability
|
|
298
|
-
export const CLINE_RULES_TEMPLATE = `# Cline LumenFlow Rules
|
|
299
|
-
|
|
300
|
-
This project uses LumenFlow workflow. See [LUMENFLOW.md](LUMENFLOW.md).
|
|
301
|
-
|
|
302
|
-
## Critical Rules
|
|
303
|
-
|
|
304
|
-
1. **Always run wu:done** - After gates pass, run \`pnpm wu:done --id WU-XXX\`
|
|
305
|
-
2. **Work in worktrees** - After \`wu:claim\`, work only in the worktree
|
|
306
|
-
3. **Never bypass hooks** - No \`--no-verify\`
|
|
307
|
-
4. **TDD** - Write tests first
|
|
308
|
-
|
|
309
|
-
## Forbidden Commands
|
|
310
|
-
|
|
311
|
-
- \`git reset --hard\`
|
|
312
|
-
- \`git push --force\`
|
|
313
|
-
- \`git stash\` (on main)
|
|
314
|
-
- \`--no-verify\`
|
|
315
|
-
|
|
316
|
-
## Quick Reference
|
|
317
|
-
|
|
318
|
-
\`\`\`bash
|
|
319
|
-
# Claim WU
|
|
320
|
-
pnpm wu:claim --id WU-XXX --lane <Lane>
|
|
321
|
-
cd worktrees/<lane>-wu-xxx
|
|
322
|
-
|
|
323
|
-
# Run gates
|
|
324
|
-
pnpm gates
|
|
325
|
-
|
|
326
|
-
# Complete (from main)
|
|
327
|
-
cd <project-root>
|
|
328
|
-
pnpm wu:done --id WU-XXX
|
|
329
|
-
\`\`\`
|
|
330
|
-
`;
|
|
331
|
-
// Template for .aider.conf.yml
|
|
332
|
-
export const AIDER_CONF_TEMPLATE = `# Aider Configuration for LumenFlow Projects\n# See LUMENFLOW.md for workflow documentation\n\nmodel: gpt-4-turbo\nauto-commits: false\ndirty-commits: false\n\nread:\n - LUMENFLOW.md\n - .lumenflow/constraints.md\n`;
|
|
333
|
-
// WU-1413: Template for .mcp.json (MCP server configuration for Claude Code)
|
|
334
|
-
export const MCP_JSON_TEMPLATE = `{
|
|
335
|
-
"mcpServers": {
|
|
336
|
-
"lumenflow": {
|
|
337
|
-
"command": "npx",
|
|
338
|
-
"args": ["@lumenflow/mcp"]
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
`;
|
|
343
|
-
// Template for docs/04-operations/tasks/backlog.md
|
|
344
|
-
export const BACKLOG_TEMPLATE = `---\nsections:\n ready:\n heading: '## 🚀 Ready (pull from here)'\n insertion: after_heading_blank_line\n in_progress:\n heading: '## 🔧 In progress'\n insertion: after_heading_blank_line\n blocked:\n heading: '## ⛔ Blocked'\n insertion: after_heading_blank_line\n done:\n heading: '## ✅ Done'\n insertion: after_heading_blank_line\n---\n\n# Backlog (single source of truth)\n\n## 🚀 Ready (pull from here)\n\n(No items ready)\n\n## 🔧 In progress\n\n(No items in progress)\n\n## ⛔ Blocked\n\n(No items blocked)\n\n## ✅ Done\n\n(No items completed yet)\n`;
|
|
345
|
-
// Template for docs/04-operations/tasks/status.md
|
|
346
|
-
export const STATUS_TEMPLATE = `# Status (active work)\n\n## In Progress\n\n(No items in progress)\n\n## Blocked\n\n(No items blocked)\n\n## Completed\n\n(No items completed yet)\n`;
|
|
347
|
-
// Template for docs tasks WU template YAML (scaffolded to {{DOCS_TASKS_PATH}}/templates/wu-template.yaml)
|
|
348
|
-
export const WU_TEMPLATE_YAML = `# Work Unit Template (LumenFlow WU Schema)\n#\n# Copy this template when creating new WUs. Fill in all required fields and\n# remove optional fields if not needed.\n#\n# If you used "lumenflow init --full", this template lives at:\n# {{DOCS_TASKS_PATH}}/templates/wu-template.yaml\n\n# Required: Unique work unit identifier (format: WU-NNN)\nid: WU-XXX\n\n# Required: Short, descriptive title (max 80 chars)\ntitle: 'Your WU title here'\n\n# Required: Lane (Parent: Sublane format)\nlane: '<Parent: Sublane>'\n\n# Required: Type of work\ntype: 'feature' # feature | bug | documentation | process | tooling | chore | refactor\n\n# Required: Current status\nstatus: 'ready' # ready | in_progress | blocked | done | cancelled\n\n# Required: Priority\npriority: P2 # P0 | P1 | P2 | P3\n\n# Required: Creation date (YYYY-MM-DD)\ncreated: {{DATE}}\n\n# Required: Owner/assignee (email)\nassigned_to: 'unassigned@example.com'\n\n# Required: Description\ndescription: |\n Context: ...\n Problem: ...\n Solution: ...\n\n# Required: Acceptance criteria (testable, binary)\nacceptance:\n - Criterion 1 (specific, measurable, testable)\n - Criterion 2 (binary pass/fail)\n - Documentation updated\n\n# Required: References to plans/specs (required for type: feature)\n# Tip: use pnpm wu:create --plan to generate a plan stub at lumenflow://plans/WU-XXX-plan.md\nspec_refs:\n - lumenflow://plans/WU-XXX-plan.md\n\n# Required: Code files changed or created (empty only for docs/process WUs)\n# Docs-only WUs should use docs/ or *.md paths to avoid docs-only gate failures.\ncode_paths:\n - path/to/file.ts\n\n# Required: Test paths (at least one of manual/unit/e2e/integration for non-doc WUs)\ntests:\n manual:\n - Manual check: Verify behavior or docs output\n unit:\n - path/to/test.test.ts\n e2e: []\n integration: []\n\n# Required: Exposure level\nexposure: 'backend-only' # ui | api | backend-only | documentation\n\n# Optional: User journey (recommended for ui/api)\n# user_journey: |\n# User navigates to ...\n# User performs ...\n\n# Optional: UI pairing WUs (for api exposure)\n# ui_pairing_wus:\n# - WU-1234\n\n# Optional: Navigation path (required when exposure=ui and no page file)\n# navigation_path: '/settings'\n\n# Required: Deliverable artifacts (stamps, docs, etc.)\nartifacts:\n - .lumenflow/stamps/WU-XXX.done\n\n# Optional: Dependencies (other WUs that must complete first)\ndependencies: []\n\n# Optional: Risks\nrisks:\n - Risk 1\n\n# Optional: Notes (required by spec linter)\nnotes: 'Implementation notes, rollout context, or plan summary.'\n\n# Optional: Requires human review\nrequires_review: false\n\n# Optional: Claimed mode (worktree or branch-only)\n# Automatically set by wu:claim, usually don't need to specify\n# claimed_mode: worktree\n\n# Optional: Assigned to (email of current claimant)\n# Automatically set by wu:claim\n# assigned_to: engineer@example.com\n\n# Optional: Locked status (prevents concurrent edits)\n# Automatically set by wu:claim and wu:done\n# locked: false\n\n# Optional: Completion date (ISO 8601 format)\n# Automatically set by wu:done\n# completed: 2025-10-23\n\n# Optional: Completion notes (added by wu:done)\n# completion_notes: |\n# Additional notes added during wu:done.\n# Any deviations from original plan.\n# Lessons learned.\n\n# ============================================================================\n# GOVERNANCE BLOCK (WU Schema v2.0)\n# ============================================================================\n# Optional: COS governance rules that apply to this WU\n# Only include if this WU needs specific governance enforcement\n\n# governance:\n# # Rules that apply to this WU (evaluated during cos:gates)\n# rules:\n# - rule_id: UPAIN-01\n# satisfied: false # Initially false, set true when evidence provided\n# evidence:\n# - type: link\n# value: docs/product/voc/feature-user-pain.md\n# description: "Voice of Customer analysis showing user pain"\n# notes: |\n# VOC analysis shows 40% of support tickets request this feature.\n# Average time wasted: 15min/user/week.\n#\n# - rule_id: CASH-03\n# satisfied: false\n# evidence:\n# - type: link\n# value: docs/finance/spend-reviews/2025-10-cloud-infra.md\n# description: "Spend review for £1200/month cloud infrastructure"\n# - type: approval\n# value: owner@example.com\n# description: "Owner approval for spend commitment"\n# notes: |\n# New cloud infrastructure commitment: £1200/month for 12 months.\n# ROI: Reduces latency by 50%, improves user retention.\n#\n# # Gate checks (enforced by cos-gates.ts)\n# gates:\n# narrative: "pending" # Status: pending, passed, skipped, failed\n# finance: "pending"\n#\n# # Exemptions (only if rule doesn't apply)\n# exemptions:\n# - rule_id: FAIR-01\n# reason: "No user-facing pricing changes in this WU"\n# approved_by: product-owner@example.com\n# approved_at: 2025-10-23\n\n# ============================================================================\n# USAGE NOTES\n# ============================================================================\n#\n# 1. Remove this entire governance block if no COS rules apply to your WU\n# 2. Only include rules that require enforcement (not all rules apply to all WUs)\n# 3. Evidence types: link:, metric:, screenshot:, approval:\n# 4. Gates are checked during wu:done (before merge)\n# 5. Exemptions require approval from rule owner\n#\n# For more details, see:\n# - {{DOCS_OPERATIONS_PATH}}/_frameworks/cos/system-prompt-v1.3.md\n# - {{DOCS_OPERATIONS_PATH}}/_frameworks/cos/evidence-format.md\n`;
|
|
349
|
-
// Template for .lumenflow.framework.yaml
|
|
350
|
-
export const FRAMEWORK_HINT_TEMPLATE = `# LumenFlow Framework Hint\n# Generated by: lumenflow init --framework {{FRAMEWORK_NAME}}\n\nframework: "{{FRAMEWORK_NAME}}"\nslug: "{{FRAMEWORK_SLUG}}"\n`;
|
|
351
|
-
// Template for docs/04-operations/_frameworks/<framework>/README.md
|
|
352
|
-
export const FRAMEWORK_OVERLAY_TEMPLATE = `# {{FRAMEWORK_NAME}} Framework Overlay\n\n**Last updated:** {{DATE}}\n\nThis overlay captures framework-specific conventions, constraints, and references for {{FRAMEWORK_NAME}} projects.\n\n## Scope\n\n- Project structure conventions\n- Framework-specific testing guidance\n- Common pitfalls and mitigations\n\n## References\n\n- Add official docs links here\n`;
|
|
353
|
-
// WU-1083: Agent onboarding docs templates
|
|
354
|
-
// WU-1309: Updated quick-ref with --docs-structure and complete wu:create example
|
|
355
|
-
export const QUICK_REF_COMMANDS_TEMPLATE = `# Quick Reference: LumenFlow Commands
|
|
356
|
-
|
|
357
|
-
**Last updated:** {{DATE}}
|
|
358
|
-
|
|
359
|
-
---
|
|
360
|
-
|
|
361
|
-
## Project Setup
|
|
362
|
-
|
|
363
|
-
| Command | Description |
|
|
364
|
-
| ---------------------------------------------------- | ----------------------------------------- |
|
|
365
|
-
| \`pnpm exec lumenflow init\` | Scaffold minimal LumenFlow core |
|
|
366
|
-
| \`pnpm exec lumenflow init --full\` | Add docs + agent onboarding scaffolding |
|
|
367
|
-
| \`pnpm exec lumenflow init --docs-structure simple\` | Use simple docs structure (docs/tasks) |
|
|
368
|
-
| \`pnpm exec lumenflow init --docs-structure arc42\` | Use arc42 structure (docs/04-operations) |
|
|
369
|
-
| \`pnpm exec lumenflow init --framework <name>\` | Add framework hint + overlay docs |
|
|
370
|
-
| \`pnpm exec lumenflow init --client <type>\` | Add client overlay (claude, cursor, etc.) |
|
|
371
|
-
| \`pnpm exec lumenflow init --force\` | Overwrite existing files |
|
|
372
|
-
|
|
373
|
-
---
|
|
374
|
-
|
|
375
|
-
## WU Management
|
|
376
|
-
|
|
377
|
-
| Command | Description |
|
|
378
|
-
| ----------------------------------------- | ------------------------------- |
|
|
379
|
-
| \`pnpm wu:create ...\` (see example below) | Create new WU |
|
|
380
|
-
| \`pnpm wu:claim --id WU-XXX --lane <Lane>\`| Claim WU (creates worktree) |
|
|
381
|
-
| \`pnpm wu:done --id WU-XXX\` | Complete WU (merge, stamp) |
|
|
382
|
-
| \`pnpm wu:block --id WU-XXX --reason "..."\`| Block a WU |
|
|
383
|
-
| \`pnpm wu:unblock --id WU-XXX\` | Unblock a WU |
|
|
384
|
-
| \`pnpm wu:status --id WU-XXX\` | Check WU status and location |
|
|
385
|
-
|
|
386
|
-
---
|
|
387
|
-
|
|
388
|
-
## Complete wu:create Example
|
|
389
|
-
|
|
390
|
-
\`\`\`bash
|
|
391
|
-
pnpm wu:create \\
|
|
392
|
-
--id WU-001 \\
|
|
393
|
-
--lane "Framework: Core" \\
|
|
394
|
-
--title "Add validation feature" \\
|
|
395
|
-
--description "Context: Users need input validation. Problem: No validation exists. Solution: Add Zod-based validation." \\
|
|
396
|
-
--acceptance "Validation rejects invalid input" \\
|
|
397
|
-
--acceptance "Unit tests cover edge cases with >90% coverage" \\
|
|
398
|
-
--acceptance "Documentation updated" \\
|
|
399
|
-
--code-paths "packages/@lumenflow/core/src/validation.ts" \\
|
|
400
|
-
--test-paths-unit "packages/@lumenflow/core/src/__tests__/validation.test.ts" \\
|
|
401
|
-
--exposure backend-only \\
|
|
402
|
-
--spec-refs "lumenflow://plans/WU-001-plan.md"
|
|
403
|
-
\`\`\`
|
|
404
|
-
|
|
405
|
-
**Required fields for code WUs:**
|
|
406
|
-
- \`--lane\`: Format is "Parent: Sublane" (e.g., "Framework: Core")
|
|
407
|
-
- \`--title\`: Short descriptive title
|
|
408
|
-
- \`--description\`: Context, Problem, Solution
|
|
409
|
-
- \`--acceptance\`: At least one (repeatable)
|
|
410
|
-
- \`--code-paths\`: Files to modify (repeatable)
|
|
411
|
-
- \`--test-paths-unit\` or \`--test-paths-e2e\`: Test files
|
|
412
|
-
- \`--exposure\`: ui | api | backend-only | documentation
|
|
413
|
-
- \`--spec-refs\`: Required for type: feature
|
|
414
|
-
|
|
415
|
-
---
|
|
416
|
-
|
|
417
|
-
## Gates
|
|
418
|
-
|
|
419
|
-
| Command | Description |
|
|
420
|
-
| ------------------------ | -------------------------- |
|
|
421
|
-
| \`pnpm gates\` | Run all quality gates |
|
|
422
|
-
| \`pnpm gates --docs-only\` | Run gates for docs changes |
|
|
423
|
-
| \`pnpm format\` | Format all files |
|
|
424
|
-
| \`pnpm lint\` | Run linter |
|
|
425
|
-
| \`pnpm typecheck\` | Run TypeScript check |
|
|
426
|
-
| \`pnpm test\` | Run tests |
|
|
427
|
-
|
|
428
|
-
---
|
|
429
|
-
|
|
430
|
-
## Git (Safe Operations)
|
|
431
|
-
|
|
432
|
-
| Command | Description |
|
|
433
|
-
| ------------------------------------ | ------------------------- |
|
|
434
|
-
| \`git status\` | Check working tree status |
|
|
435
|
-
| \`git add .\` | Stage all changes |
|
|
436
|
-
| \`git commit -m "type: message"\` | Commit with message |
|
|
437
|
-
| \`git push origin lane/<lane>/wu-xxx\` | Push to remote |
|
|
438
|
-
|
|
439
|
-
---
|
|
440
|
-
|
|
441
|
-
## Navigation
|
|
442
|
-
|
|
443
|
-
\`\`\`bash
|
|
444
|
-
# After claiming, go to worktree
|
|
445
|
-
cd worktrees/<lane>-wu-xxx
|
|
446
|
-
|
|
447
|
-
# Return to main for wu:done
|
|
448
|
-
cd <project-root>
|
|
449
|
-
\`\`\`
|
|
450
|
-
|
|
451
|
-
---
|
|
452
|
-
|
|
453
|
-
## Workflow Sequence
|
|
454
|
-
|
|
455
|
-
\`\`\`bash
|
|
456
|
-
# 1. Create (see complete example above)
|
|
457
|
-
pnpm wu:create --id WU-001 --lane "Framework: Core" --title "Add feature" \\
|
|
458
|
-
--description "Context: ... Problem: ... Solution: ..." \\
|
|
459
|
-
--acceptance "Feature works" --acceptance "Tests pass" \\
|
|
460
|
-
--code-paths "src/feature.ts" \\
|
|
461
|
-
--test-paths-unit "src/__tests__/feature.test.ts" \\
|
|
462
|
-
--exposure backend-only \\
|
|
463
|
-
--spec-refs "lumenflow://plans/WU-001-plan.md"
|
|
464
|
-
|
|
465
|
-
# 2. Claim
|
|
466
|
-
pnpm wu:claim --id WU-001 --lane "Framework: Core"
|
|
467
|
-
cd worktrees/framework-core-wu-001
|
|
468
|
-
|
|
469
|
-
# 3. Work (TDD)
|
|
470
|
-
# ... write tests first, then code ...
|
|
471
|
-
|
|
472
|
-
# 4. Commit
|
|
473
|
-
git add .
|
|
474
|
-
git commit -m "feat: add feature"
|
|
475
|
-
git push origin lane/framework-core/wu-001
|
|
476
|
-
|
|
477
|
-
# 5. Gates
|
|
478
|
-
pnpm gates
|
|
479
|
-
|
|
480
|
-
# 6. Complete (from main checkout)
|
|
481
|
-
cd <project-root>
|
|
482
|
-
pnpm wu:done --id WU-001
|
|
483
|
-
\`\`\`
|
|
484
|
-
|
|
485
|
-
---
|
|
486
|
-
|
|
487
|
-
## File Paths
|
|
488
|
-
|
|
489
|
-
| Path | Description |
|
|
490
|
-
| ------------------------------------ | -------------------- |
|
|
491
|
-
| \`{{DOCS_TASKS_PATH}}/wu/WU-XXX.yaml\` | WU specification |
|
|
492
|
-
| \`{{DOCS_TASKS_PATH}}/status.md\` | Current status board |
|
|
493
|
-
| \`.lumenflow/stamps/WU-XXX.done\` | Completion stamp |
|
|
494
|
-
| \`worktrees/<lane>-wu-xxx/\` | Worktree directory |
|
|
495
|
-
`;
|
|
496
|
-
export const FIRST_WU_MISTAKES_TEMPLATE = `# First WU Mistakes
|
|
497
|
-
|
|
498
|
-
**Last updated:** {{DATE}}
|
|
499
|
-
|
|
500
|
-
Common mistakes agents make on their first WU, and how to avoid them.
|
|
501
|
-
|
|
502
|
-
---
|
|
503
|
-
|
|
504
|
-
## Mistake 1: Not Using Worktrees
|
|
505
|
-
|
|
506
|
-
### Wrong
|
|
507
|
-
|
|
508
|
-
\`\`\`bash
|
|
509
|
-
# Working directly in main
|
|
510
|
-
vim src/feature.ts
|
|
511
|
-
git commit -m "feat: add feature"
|
|
512
|
-
git push origin main
|
|
513
|
-
\`\`\`
|
|
514
|
-
|
|
515
|
-
### Right
|
|
516
|
-
|
|
517
|
-
\`\`\`bash
|
|
518
|
-
# Claim first, then work in worktree
|
|
519
|
-
pnpm wu:claim --id WU-123 --lane Core
|
|
520
|
-
cd worktrees/core-wu-123
|
|
521
|
-
vim src/feature.ts
|
|
522
|
-
git commit -m "feat: add feature"
|
|
523
|
-
git push origin lane/core/wu-123
|
|
524
|
-
cd /path/to/main
|
|
525
|
-
pnpm wu:done --id WU-123
|
|
526
|
-
\`\`\`
|
|
527
|
-
|
|
528
|
-
---
|
|
529
|
-
|
|
530
|
-
## Mistake 2: Forgetting to Run wu:done
|
|
531
|
-
|
|
532
|
-
See [troubleshooting-wu-done.md](troubleshooting-wu-done.md) for the full explanation.
|
|
533
|
-
|
|
534
|
-
**TL;DR:** After gates pass, ALWAYS run \`pnpm wu:done --id WU-XXX\`.
|
|
535
|
-
|
|
536
|
-
---
|
|
537
|
-
|
|
538
|
-
## Mistake 3: Working Outside code_paths
|
|
539
|
-
|
|
540
|
-
### Wrong
|
|
541
|
-
|
|
542
|
-
The WU says \`code_paths: [src/api/**]\` but you edit \`src/ui/component.ts\`.
|
|
543
|
-
|
|
544
|
-
### Right
|
|
545
|
-
|
|
546
|
-
Only edit files within the specified \`code_paths\`. If you need to edit other files, that's a different WU.
|
|
547
|
-
|
|
548
|
-
---
|
|
549
|
-
|
|
550
|
-
## Mistake 4: Skipping TDD
|
|
551
|
-
|
|
552
|
-
### Wrong
|
|
553
|
-
|
|
554
|
-
\`\`\`
|
|
555
|
-
1. Write the feature
|
|
556
|
-
2. Maybe write tests later
|
|
557
|
-
3. Tests are hard, skip them
|
|
558
|
-
\`\`\`
|
|
559
|
-
|
|
560
|
-
### Right
|
|
561
|
-
|
|
562
|
-
\`\`\`
|
|
563
|
-
1. Write failing test
|
|
564
|
-
2. Run test (confirm RED)
|
|
565
|
-
3. Write minimum code
|
|
566
|
-
4. Run test (confirm GREEN)
|
|
567
|
-
5. Refactor if needed
|
|
568
|
-
\`\`\`
|
|
569
|
-
|
|
570
|
-
---
|
|
571
|
-
|
|
572
|
-
## Mistake 5: Using Forbidden Git Commands
|
|
573
|
-
|
|
574
|
-
### Wrong
|
|
575
|
-
|
|
576
|
-
\`\`\`bash
|
|
577
|
-
git reset --hard HEAD
|
|
578
|
-
git push --force
|
|
579
|
-
git commit --no-verify
|
|
580
|
-
\`\`\`
|
|
581
|
-
|
|
582
|
-
### Right
|
|
583
|
-
|
|
584
|
-
\`\`\`bash
|
|
585
|
-
git add .
|
|
586
|
-
git commit -m "feat: description"
|
|
587
|
-
git push origin lane/core/wu-123
|
|
588
|
-
\`\`\`
|
|
589
|
-
|
|
590
|
-
---
|
|
591
|
-
|
|
592
|
-
## Mistake 6: Ignoring Gate Failures
|
|
593
|
-
|
|
594
|
-
### Wrong
|
|
595
|
-
|
|
596
|
-
\`\`\`
|
|
597
|
-
Gates failed but I think the code is fine.
|
|
598
|
-
Let me use --skip-gates.
|
|
599
|
-
\`\`\`
|
|
600
|
-
|
|
601
|
-
### Right
|
|
602
|
-
|
|
603
|
-
\`\`\`
|
|
604
|
-
Gates failed. Let me read the error:
|
|
605
|
-
- TypeScript error in src/api/handler.ts
|
|
606
|
-
- Missing return type
|
|
607
|
-
|
|
608
|
-
Fix: Add the return type.
|
|
609
|
-
Re-run: pnpm gates
|
|
610
|
-
\`\`\`
|
|
611
|
-
|
|
612
|
-
---
|
|
613
|
-
|
|
614
|
-
## Quick Checklist
|
|
615
|
-
|
|
616
|
-
Before starting UnsafeAny WU:
|
|
617
|
-
|
|
618
|
-
- [ ] Read the full WU spec
|
|
619
|
-
- [ ] Understand acceptance criteria
|
|
620
|
-
- [ ] Claim the WU with \`pnpm wu:claim\`
|
|
621
|
-
- [ ] cd to the worktree IMMEDIATELY
|
|
622
|
-
- [ ] Work only in the worktree
|
|
623
|
-
- [ ] Stay within code_paths
|
|
624
|
-
- [ ] Follow TDD
|
|
625
|
-
- [ ] Run gates before wu:done
|
|
626
|
-
- [ ] ALWAYS run wu:done
|
|
627
|
-
`;
|
|
628
|
-
export const TROUBLESHOOTING_WU_DONE_TEMPLATE = `# Troubleshooting: wu:done Not Run
|
|
629
|
-
|
|
630
|
-
**Last updated:** {{DATE}}
|
|
631
|
-
|
|
632
|
-
This is the most common mistake agents make. This document explains why it happens and how to fix it.
|
|
633
|
-
|
|
634
|
-
---
|
|
635
|
-
|
|
636
|
-
## The Problem
|
|
637
|
-
|
|
638
|
-
Agents complete their work, write "To Complete: pnpm wu:done --id WU-XXX" in their response, and then **stop without actually running the command**.
|
|
639
|
-
|
|
640
|
-
### Why This Happens
|
|
641
|
-
|
|
642
|
-
1. **Confusion about scope**: Agent thinks completion is a "next step" for the human
|
|
643
|
-
2. **Fear of overstepping**: Agent hesitates to take "final" actions
|
|
644
|
-
3. **Missing context**: Agent doesn't realize wu:done is expected to be run immediately
|
|
645
|
-
4. **Token limits**: Agent runs out of context and summarizes remaining steps
|
|
646
|
-
|
|
647
|
-
---
|
|
648
|
-
|
|
649
|
-
## The Fix
|
|
650
|
-
|
|
651
|
-
### Rule: ALWAYS Run wu:done
|
|
652
|
-
|
|
653
|
-
After gates pass, you MUST run:
|
|
654
|
-
|
|
655
|
-
\`\`\`bash
|
|
656
|
-
cd /path/to/main
|
|
657
|
-
pnpm wu:done --id WU-XXX
|
|
658
|
-
\`\`\`
|
|
659
|
-
|
|
660
|
-
Do NOT:
|
|
661
|
-
|
|
662
|
-
- Ask "Should I run wu:done?"
|
|
663
|
-
- Write "To Complete: pnpm wu:done"
|
|
664
|
-
- Wait for permission
|
|
665
|
-
- Treat it as a "future step"
|
|
666
|
-
|
|
667
|
-
---
|
|
668
|
-
|
|
669
|
-
## Correct Completion Flow
|
|
670
|
-
|
|
671
|
-
\`\`\`bash
|
|
672
|
-
# 1. In worktree, run gates
|
|
673
|
-
pnpm gates
|
|
674
|
-
|
|
675
|
-
# 2. If gates pass, return to main
|
|
676
|
-
cd /path/to/main
|
|
677
|
-
|
|
678
|
-
# 3. IMMEDIATELY run wu:done
|
|
679
|
-
pnpm wu:done --id WU-XXX
|
|
680
|
-
|
|
681
|
-
# 4. Report success with the wu:done output
|
|
682
|
-
\`\`\`
|
|
683
|
-
|
|
684
|
-
---
|
|
685
|
-
|
|
686
|
-
## What wu:done Does
|
|
687
|
-
|
|
688
|
-
When you run \`pnpm wu:done --id WU-XXX\`:
|
|
689
|
-
|
|
690
|
-
1. Validates the worktree exists and has commits
|
|
691
|
-
2. Runs gates in the worktree (not main)
|
|
692
|
-
3. Fast-forward merges to main
|
|
693
|
-
4. Creates the done stamp
|
|
694
|
-
5. Updates status and backlog docs
|
|
695
|
-
6. Removes the worktree
|
|
696
|
-
7. Pushes to origin
|
|
697
|
-
|
|
698
|
-
**This is the ONLY way to complete a WU.** Manual steps will leave things in an inconsistent state.
|
|
699
|
-
|
|
700
|
-
---
|
|
701
|
-
|
|
702
|
-
## Symptoms of Incomplete WU
|
|
703
|
-
|
|
704
|
-
If wu:done wasn't run, you'll see:
|
|
705
|
-
|
|
706
|
-
- Worktree still exists: \`ls worktrees/\`
|
|
707
|
-
- No stamp: \`ls .lumenflow/stamps/WU-XXX.done\` returns nothing
|
|
708
|
-
- Status unchanged: WU still shows as \`in_progress\`
|
|
709
|
-
- Branch not merged: Changes only on lane branch
|
|
710
|
-
|
|
711
|
-
---
|
|
712
|
-
|
|
713
|
-
## Recovery
|
|
714
|
-
|
|
715
|
-
If a previous agent forgot to run wu:done:
|
|
716
|
-
|
|
717
|
-
\`\`\`bash
|
|
718
|
-
# 1. Check worktree exists
|
|
719
|
-
ls worktrees/
|
|
720
|
-
|
|
721
|
-
# 2. If it does, run wu:done
|
|
722
|
-
pnpm wu:done --id WU-XXX
|
|
723
|
-
\`\`\`
|
|
724
|
-
|
|
725
|
-
---
|
|
726
|
-
|
|
727
|
-
## Checklist Before Ending Session
|
|
728
|
-
|
|
729
|
-
- [ ] Did I run \`pnpm gates\` in the worktree?
|
|
730
|
-
- [ ] Did gates pass?
|
|
731
|
-
- [ ] Did I \`cd\` back to main?
|
|
732
|
-
- [ ] Did I run \`pnpm wu:done --id WU-XXX\`?
|
|
733
|
-
- [ ] Did wu:done complete successfully?
|
|
734
|
-
|
|
735
|
-
If UnsafeAny answer is "no", you're not done yet.
|
|
736
|
-
`;
|
|
737
|
-
export const AGENT_SAFETY_CARD_TEMPLATE = `# Agent Safety Card
|
|
738
|
-
|
|
739
|
-
**Last updated:** {{DATE}}
|
|
740
|
-
|
|
741
|
-
Quick reference for AI agents working in LumenFlow projects.
|
|
742
|
-
|
|
743
|
-
---
|
|
744
|
-
|
|
745
|
-
## Stop and Ask When
|
|
746
|
-
|
|
747
|
-
- Same error repeats 3 times
|
|
748
|
-
- Auth or permissions changes needed
|
|
749
|
-
- PII/secrets involved
|
|
750
|
-
- Cloud spend decisions
|
|
751
|
-
- Policy changes required
|
|
752
|
-
- Anything feels irreversible
|
|
753
|
-
|
|
754
|
-
---
|
|
755
|
-
|
|
756
|
-
## Never Do
|
|
757
|
-
|
|
758
|
-
| Action | Why |
|
|
759
|
-
| ------------------------ | ---------------- |
|
|
760
|
-
| \`git reset --hard\` | Data loss |
|
|
761
|
-
| \`git push --force\` | History rewrite |
|
|
762
|
-
| \`--no-verify\` | Bypasses safety |
|
|
763
|
-
| \`git stash\` (on main) | Hides work |
|
|
764
|
-
| \`git clean -fd\` | Deletes files |
|
|
765
|
-
| Work in main after claim | Breaks isolation |
|
|
766
|
-
| Skip wu:done | Incomplete WU |
|
|
767
|
-
|
|
768
|
-
---
|
|
769
|
-
|
|
770
|
-
## Always Do
|
|
771
|
-
|
|
772
|
-
| Action | Why |
|
|
773
|
-
| -------------------------- | ---------------- |
|
|
774
|
-
| Read WU spec first | Understand scope |
|
|
775
|
-
| cd to worktree after claim | Isolation |
|
|
776
|
-
| Write tests before code | TDD |
|
|
777
|
-
| Run gates before wu:done | Quality |
|
|
778
|
-
| Run wu:done | Complete WU |
|
|
779
|
-
| Stay within code_paths | Scope discipline |
|
|
780
|
-
|
|
781
|
-
---
|
|
782
|
-
|
|
783
|
-
## Error Handling
|
|
784
|
-
|
|
785
|
-
### Max 3 Attempts
|
|
786
|
-
|
|
787
|
-
If same error happens 3 times:
|
|
788
|
-
|
|
789
|
-
1. Stop trying
|
|
790
|
-
2. Document what happened
|
|
791
|
-
3. Ask for help
|
|
792
|
-
|
|
793
|
-
### Gate Failures
|
|
794
|
-
|
|
795
|
-
1. Read the error message
|
|
796
|
-
2. Fix the underlying issue
|
|
797
|
-
3. Re-run gates
|
|
798
|
-
4. Never use \`--skip-gates\` for new failures
|
|
799
|
-
|
|
800
|
-
---
|
|
801
|
-
|
|
802
|
-
## Quick Commands
|
|
803
|
-
|
|
804
|
-
\`\`\`bash
|
|
805
|
-
# Check lane availability
|
|
806
|
-
cat {{DOCS_TASKS_PATH}}/status.md
|
|
807
|
-
|
|
808
|
-
# Claim a WU
|
|
809
|
-
pnpm wu:claim --id WU-XXX --lane <Lane>
|
|
810
|
-
|
|
811
|
-
# Work in worktree
|
|
812
|
-
cd worktrees/<lane>-wu-xxx
|
|
813
|
-
|
|
814
|
-
# Run gates
|
|
815
|
-
pnpm gates # Code changes
|
|
816
|
-
pnpm gates --docs-only # Docs changes
|
|
817
|
-
|
|
818
|
-
# Complete WU
|
|
819
|
-
cd /path/to/main
|
|
820
|
-
pnpm wu:done --id WU-XXX
|
|
821
|
-
\`\`\`
|
|
822
|
-
|
|
823
|
-
---
|
|
824
|
-
|
|
825
|
-
## Completion Checklist
|
|
826
|
-
|
|
827
|
-
- [ ] Gates pass
|
|
828
|
-
- [ ] cd to main
|
|
829
|
-
- [ ] Run wu:done
|
|
830
|
-
- [ ] Verify success output
|
|
831
|
-
- [ ] Report completion
|
|
832
|
-
|
|
833
|
-
---
|
|
834
|
-
|
|
835
|
-
## When Uncertain
|
|
836
|
-
|
|
837
|
-
Choose the safer path:
|
|
838
|
-
|
|
839
|
-
- Don't modify files outside code_paths
|
|
840
|
-
- Don't bypass hooks
|
|
841
|
-
- Don't skip gates
|
|
842
|
-
- Ask rather than assume
|
|
843
|
-
`;
|
|
844
|
-
// WU-1307: Lane inference configuration template (hierarchical Parent→Sublane format)
|
|
845
|
-
// WU-1364: Added Core and Feature as parent lanes for intuitive naming
|
|
846
|
-
// WU-1382: Added managed file header to prevent manual edits
|
|
847
|
-
// This format is required by lane-inference.ts and lane-checker.ts
|
|
848
|
-
export const LANE_INFERENCE_TEMPLATE = `# ============================================================================
|
|
849
|
-
# LUMENFLOW MANAGED FILE - DO NOT EDIT MANUALLY
|
|
850
|
-
# ============================================================================
|
|
851
|
-
# Generated by: lumenflow init
|
|
852
|
-
# Regenerate with: pnpm exec lumenflow init --force
|
|
853
|
-
#
|
|
854
|
-
# This file is managed by LumenFlow tooling. Manual edits may be overwritten.
|
|
855
|
-
# To customize lanes, use: pnpm lane:suggest --output .lumenflow.lane-inference.yaml
|
|
856
|
-
# ============================================================================
|
|
857
|
-
|
|
858
|
-
# Lane Inference Configuration
|
|
859
|
-
#
|
|
860
|
-
# Hierarchical format: Parent -> Sublane -> { code_paths, keywords }
|
|
861
|
-
# This format is required by lane-inference.ts for proper sub-lane suggestion.
|
|
862
|
-
#
|
|
863
|
-
# Common parent lanes: Core, Feature, Framework, Experience, Operations, Content
|
|
864
|
-
|
|
865
|
-
# Core Lane: Platform foundations, shared libraries, base infrastructure
|
|
866
|
-
Core:
|
|
867
|
-
Platform:
|
|
868
|
-
description: 'Core platform: shared utilities, base infrastructure, common libraries'
|
|
869
|
-
code_paths:
|
|
870
|
-
- 'packages/**/core/**'
|
|
871
|
-
- 'src/core/**'
|
|
872
|
-
- 'src/lib/**'
|
|
873
|
-
- 'lib/**'
|
|
874
|
-
keywords:
|
|
875
|
-
- 'platform'
|
|
876
|
-
- 'core'
|
|
877
|
-
- 'infrastructure'
|
|
878
|
-
- 'foundation'
|
|
879
|
-
|
|
880
|
-
Library:
|
|
881
|
-
description: 'Shared libraries and utilities'
|
|
882
|
-
code_paths:
|
|
883
|
-
- 'packages/**/lib/**'
|
|
884
|
-
- 'src/utils/**'
|
|
885
|
-
- 'src/helpers/**'
|
|
886
|
-
keywords:
|
|
887
|
-
- 'library'
|
|
888
|
-
- 'utility'
|
|
889
|
-
- 'helper'
|
|
890
|
-
- 'shared'
|
|
891
|
-
|
|
892
|
-
# Feature Lane: Product features and user-facing functionality
|
|
893
|
-
Feature:
|
|
894
|
-
Backend:
|
|
895
|
-
description: 'Backend features: APIs, services, business logic'
|
|
896
|
-
code_paths:
|
|
897
|
-
- 'src/api/**'
|
|
898
|
-
- 'src/services/**'
|
|
899
|
-
- 'packages/**/api/**'
|
|
900
|
-
keywords:
|
|
901
|
-
- 'api'
|
|
902
|
-
- 'service'
|
|
903
|
-
- 'backend'
|
|
904
|
-
- 'business logic'
|
|
905
|
-
|
|
906
|
-
Frontend:
|
|
907
|
-
description: 'Frontend features: UI, components, pages'
|
|
908
|
-
code_paths:
|
|
909
|
-
- 'src/components/**'
|
|
910
|
-
- 'src/pages/**'
|
|
911
|
-
- 'src/app/**'
|
|
912
|
-
- 'apps/web/**'
|
|
913
|
-
keywords:
|
|
914
|
-
- 'frontend'
|
|
915
|
-
- 'ui'
|
|
916
|
-
- 'component'
|
|
917
|
-
- 'page'
|
|
918
|
-
|
|
919
|
-
# Framework Lane: Framework-specific code and tooling
|
|
920
|
-
Framework:
|
|
921
|
-
Core:
|
|
922
|
-
description: 'Core framework: business logic, domain models, utilities'
|
|
923
|
-
code_paths:
|
|
924
|
-
- 'packages/**/core/**'
|
|
925
|
-
- 'src/core/**'
|
|
926
|
-
- 'lib/**'
|
|
927
|
-
keywords:
|
|
928
|
-
- 'core library'
|
|
929
|
-
- 'business logic'
|
|
930
|
-
- 'domain'
|
|
931
|
-
- 'utility'
|
|
932
|
-
|
|
933
|
-
CLI:
|
|
934
|
-
description: 'CLI commands and tooling'
|
|
935
|
-
code_paths:
|
|
936
|
-
- 'packages/**/cli/**'
|
|
937
|
-
- 'src/cli/**'
|
|
938
|
-
- 'bin/**'
|
|
939
|
-
keywords:
|
|
940
|
-
- 'cli command'
|
|
941
|
-
- 'command line'
|
|
942
|
-
- 'tooling'
|
|
943
|
-
|
|
944
|
-
# Experience Lane: User-facing frontend work
|
|
945
|
-
Experience:
|
|
946
|
-
UI:
|
|
947
|
-
description: 'User interface components and pages'
|
|
948
|
-
code_paths:
|
|
949
|
-
- 'apps/web/**'
|
|
950
|
-
- 'src/components/**'
|
|
951
|
-
- 'src/pages/**'
|
|
952
|
-
- 'src/app/**'
|
|
953
|
-
keywords:
|
|
954
|
-
- 'ui'
|
|
955
|
-
- 'component'
|
|
956
|
-
- 'page'
|
|
957
|
-
- 'frontend'
|
|
958
|
-
- 'user interface'
|
|
959
|
-
|
|
960
|
-
Web:
|
|
961
|
-
description: 'Web application features'
|
|
962
|
-
code_paths:
|
|
963
|
-
- 'apps/web/**'
|
|
964
|
-
- 'web/**'
|
|
965
|
-
keywords:
|
|
966
|
-
- 'web'
|
|
967
|
-
- 'browser'
|
|
968
|
-
- 'frontend'
|
|
969
|
-
|
|
970
|
-
# Operations Lane: Infrastructure and CI/CD
|
|
971
|
-
Operations:
|
|
972
|
-
Infrastructure:
|
|
973
|
-
description: 'Apps, deployment, hosting configuration'
|
|
974
|
-
code_paths:
|
|
975
|
-
- 'apps/**'
|
|
976
|
-
- 'infrastructure/**'
|
|
977
|
-
- 'deploy/**'
|
|
978
|
-
- 'turbo.json'
|
|
979
|
-
- 'pnpm-workspace.yaml'
|
|
980
|
-
keywords:
|
|
981
|
-
- 'infrastructure'
|
|
982
|
-
- 'deployment'
|
|
983
|
-
- 'hosting'
|
|
984
|
-
- 'monorepo'
|
|
985
|
-
|
|
986
|
-
CI/CD:
|
|
987
|
-
description: 'GitHub Actions, workflows, build pipelines'
|
|
988
|
-
code_paths:
|
|
989
|
-
- '.github/workflows/**'
|
|
990
|
-
- '.github/actions/**'
|
|
991
|
-
- '.github/**'
|
|
992
|
-
- '.circleci/**'
|
|
993
|
-
keywords:
|
|
994
|
-
- 'ci'
|
|
995
|
-
- 'cd'
|
|
996
|
-
- 'github actions'
|
|
997
|
-
- 'workflow'
|
|
998
|
-
- 'pipeline'
|
|
999
|
-
|
|
1000
|
-
# Content Lane: Documentation
|
|
1001
|
-
Content:
|
|
1002
|
-
Documentation:
|
|
1003
|
-
description: 'All documentation: guides, references, specs'
|
|
1004
|
-
code_paths:
|
|
1005
|
-
- 'docs/**'
|
|
1006
|
-
- '*.md'
|
|
1007
|
-
- 'README.md'
|
|
1008
|
-
keywords:
|
|
1009
|
-
- 'documentation'
|
|
1010
|
-
- 'docs'
|
|
1011
|
-
- 'guide'
|
|
1012
|
-
- 'readme'
|
|
1013
|
-
- 'markdown'
|
|
1014
|
-
{{FRAMEWORK_LANES}}
|
|
1015
|
-
`;
|
|
1016
|
-
// WU-1300: Starting prompt template for agent onboarding
|
|
1017
|
-
// WU-1364: Added "When Starting From Product Vision" section for initiative-first workflow
|
|
1018
|
-
export const STARTING_PROMPT_TEMPLATE = `# Starting Prompt for LumenFlow Agents
|
|
1019
|
-
|
|
1020
|
-
**Last updated:** {{DATE}}
|
|
1021
|
-
|
|
1022
|
-
This document provides the initial context for AI agents working on this project.
|
|
1023
|
-
|
|
1024
|
-
---
|
|
1025
|
-
|
|
1026
|
-
## When Starting From Product Vision
|
|
1027
|
-
|
|
1028
|
-
If you are starting a new project or feature from a product vision (e.g., "Build a task management app"), **do NOT create standalone WUs immediately**. Instead, follow the initiative-first workflow:
|
|
1029
|
-
|
|
1030
|
-
### 4-Step Initiative Workflow
|
|
1031
|
-
|
|
1032
|
-
1. **Create an Initiative**: Capture the vision as an initiative
|
|
1033
|
-
\`\`\`bash
|
|
1034
|
-
pnpm initiative:create --id INIT-001 --title "Task Management App" \\
|
|
1035
|
-
--description "Build a task management application with..." \\
|
|
1036
|
-
--phase "Phase 1: Core MVP" --phase "Phase 2: Collaboration"
|
|
1037
|
-
\`\`\`
|
|
1038
|
-
|
|
1039
|
-
2. **Define Phases**: Break the vision into logical phases (MVP, iteration, polish)
|
|
1040
|
-
|
|
1041
|
-
3. **Create WUs under the Initiative**: Each WU belongs to a phase
|
|
1042
|
-
\`\`\`bash
|
|
1043
|
-
pnpm wu:create --lane "Core: Platform" --title "Add task model" \\
|
|
1044
|
-
--description "..." --acceptance "..." --code-paths "..." \\
|
|
1045
|
-
&& pnpm initiative:add-wu --initiative INIT-001 --wu WU-XXX --phase 1
|
|
1046
|
-
\`\`\`
|
|
1047
|
-
|
|
1048
|
-
4. **Track Progress**: Use \`pnpm initiative:status --id INIT-001\` to see overall progress
|
|
1049
|
-
|
|
1050
|
-
### Why Initiatives Matter
|
|
1051
|
-
|
|
1052
|
-
- **Avoid orphan WUs**: Without initiative structure, agents create disconnected WUs that lack coherent scope
|
|
1053
|
-
- **Better coordination**: Phases enable parallel work across lanes
|
|
1054
|
-
- **Clear completion criteria**: The initiative tracks when all phases are done
|
|
1055
|
-
- **Visibility**: Stakeholders can see multi-phase progress
|
|
1056
|
-
|
|
1057
|
-
### When to Skip Initiatives
|
|
1058
|
-
|
|
1059
|
-
Only skip initiatives for:
|
|
1060
|
-
- Single-file bug fixes
|
|
1061
|
-
- Small documentation updates
|
|
1062
|
-
- Isolated refactoring tasks
|
|
1063
|
-
|
|
1064
|
-
If work spans multiple WUs or multiple days, create an initiative first.
|
|
1065
|
-
|
|
1066
|
-
---
|
|
1067
|
-
|
|
1068
|
-
## Step 1: Read Core Documentation
|
|
1069
|
-
|
|
1070
|
-
Before starting UnsafeAny work, read these documents in order:
|
|
1071
|
-
|
|
1072
|
-
1. **[LUMENFLOW.md](../../../../../../LUMENFLOW.md)** - Main workflow documentation
|
|
1073
|
-
2. **[constraints.md](../../../../../../.lumenflow/constraints.md)** - Non-negotiable rules
|
|
1074
|
-
3. **This file** - Onboarding context
|
|
1075
|
-
|
|
1076
|
-
---
|
|
1077
|
-
|
|
1078
|
-
## Step 2: Understand the Workflow
|
|
1079
|
-
|
|
1080
|
-
LumenFlow uses Work Units (WUs) to track all changes:
|
|
1081
|
-
|
|
1082
|
-
1. **Claim a WU**: \`pnpm wu:claim --id WU-XXX --lane <Lane>\`
|
|
1083
|
-
2. **Work in worktree**: \`cd worktrees/<lane>-wu-xxx\`
|
|
1084
|
-
3. **Run gates**: \`pnpm gates\`
|
|
1085
|
-
4. **Complete WU**: \`pnpm wu:done --id WU-XXX\` (from main checkout)
|
|
1086
|
-
|
|
1087
|
-
---
|
|
1088
|
-
|
|
1089
|
-
## Step 3: Key Constraints
|
|
1090
|
-
|
|
1091
|
-
1. **Worktree Discipline**: Never work in main after claiming a WU
|
|
1092
|
-
2. **TDD**: Write tests first, then implementation
|
|
1093
|
-
3. **Gates**: Must pass before \`wu:done\`
|
|
1094
|
-
4. **Always wu:done**: Never skip the completion step
|
|
1095
|
-
|
|
1096
|
-
---
|
|
1097
|
-
|
|
1098
|
-
## Step 4: Common Commands
|
|
1099
|
-
|
|
1100
|
-
| Command | Description |
|
|
1101
|
-
| ------- | ----------- |
|
|
1102
|
-
| \`pnpm wu:claim --id WU-XXX --lane <Lane>\` | Claim a WU |
|
|
1103
|
-
| \`pnpm gates\` | Run quality gates |
|
|
1104
|
-
| \`pnpm wu:done --id WU-XXX\` | Complete WU |
|
|
1105
|
-
| \`pnpm wu:status --id WU-XXX\` | Check WU status |
|
|
1106
|
-
| \`pnpm initiative:create ...\` | Create a new initiative |
|
|
1107
|
-
| \`pnpm initiative:status --id INIT-XXX\` | Check initiative progress |
|
|
1108
|
-
|
|
1109
|
-
---
|
|
1110
|
-
|
|
1111
|
-
## Step 5: When Stuck
|
|
1112
|
-
|
|
1113
|
-
1. Read the WU spec at \`{{DOCS_TASKS_PATH}}/wu/WU-XXX.yaml\`
|
|
1114
|
-
2. Check [troubleshooting-wu-done.md](troubleshooting-wu-done.md)
|
|
1115
|
-
3. Review [first-wu-mistakes.md](first-wu-mistakes.md)
|
|
1116
|
-
|
|
1117
|
-
---
|
|
1118
|
-
|
|
1119
|
-
## Additional Resources
|
|
1120
|
-
|
|
1121
|
-
- [quick-ref-commands.md](quick-ref-commands.md) - Complete command reference
|
|
1122
|
-
- [agent-safety-card.md](agent-safety-card.md) - Safety guidelines
|
|
1123
|
-
- [wu-create-checklist.md](wu-create-checklist.md) - WU creation guide
|
|
1124
|
-
- [wu-sizing-guide.md](wu-sizing-guide.md) - WU complexity and context management
|
|
1125
|
-
`;
|
|
1126
|
-
export const WU_CREATE_CHECKLIST_TEMPLATE = `# WU Creation Checklist
|
|
1127
|
-
|
|
1128
|
-
**Last updated:** {{DATE}}
|
|
1129
|
-
|
|
1130
|
-
Before running \`pnpm wu:create\`, verify these items.
|
|
1131
|
-
|
|
1132
|
-
---
|
|
1133
|
-
|
|
1134
|
-
## Step 1: Check Valid Lanes
|
|
1135
|
-
|
|
1136
|
-
\`\`\`bash
|
|
1137
|
-
grep -A 30 "lanes:" .lumenflow.config.yaml
|
|
1138
|
-
\`\`\`
|
|
1139
|
-
|
|
1140
|
-
**Format:** \`"Parent: Sublane"\` (colon + single space)
|
|
1141
|
-
|
|
1142
|
-
Examples:
|
|
1143
|
-
- \`"Framework: CLI"\`
|
|
1144
|
-
- \`"Framework: Core"\`
|
|
1145
|
-
- \`"Operations: CI/CD"\`
|
|
1146
|
-
- \`"Content: Documentation"\`
|
|
1147
|
-
|
|
1148
|
-
---
|
|
1149
|
-
|
|
1150
|
-
## Step 2: Required Fields
|
|
1151
|
-
|
|
1152
|
-
| Field | Required For | Example |
|
|
1153
|
-
|-------|--------------|---------|
|
|
1154
|
-
| \`--id\` | All | \`WU-1234\` |
|
|
1155
|
-
| \`--lane\` | All | \`"Experience: Chat"\` |
|
|
1156
|
-
| \`--title\` | All | \`"Add feature"\` |
|
|
1157
|
-
| \`--description\` | All | \`"Context: ... Problem: ... Solution: ..."\` |
|
|
1158
|
-
| \`--acceptance\` | All | \`--acceptance "Works"\` (repeatable) |
|
|
1159
|
-
| \`--exposure\` | All | \`ui\`, \`api\`, \`backend-only\`, \`documentation\` |
|
|
1160
|
-
| \`--code-paths\` | Code WUs | \`"src/a.ts,src/b.ts"\` |
|
|
1161
|
-
| \`--test-paths-unit\` | Code WUs | \`"src/__tests__/a.test.ts"\` |
|
|
1162
|
-
| \`--spec-refs\` | Feature WUs | \`"~/.lumenflow/plans/WU-XXX.md"\` |
|
|
1163
|
-
|
|
1164
|
-
---
|
|
1165
|
-
|
|
1166
|
-
## Step 3: Plan Storage
|
|
1167
|
-
|
|
1168
|
-
Plans go in \`~/.lumenflow/plans/\` (NOT in project):
|
|
1169
|
-
|
|
1170
|
-
\`\`\`bash
|
|
1171
|
-
mkdir -p ~/.lumenflow/plans
|
|
1172
|
-
# Create your plan
|
|
1173
|
-
vim ~/.lumenflow/plans/WU-XXX-plan.md
|
|
1174
|
-
\`\`\`
|
|
1175
|
-
|
|
1176
|
-
Reference in wu:create:
|
|
1177
|
-
\`\`\`bash
|
|
1178
|
-
--spec-refs "~/.lumenflow/plans/WU-XXX-plan.md"
|
|
1179
|
-
\`\`\`
|
|
1180
|
-
|
|
1181
|
-
---
|
|
1182
|
-
|
|
1183
|
-
## Step 4: Validate First
|
|
1184
|
-
|
|
1185
|
-
\`\`\`bash
|
|
1186
|
-
pnpm wu:create --id WU-XXX ... --validate
|
|
1187
|
-
\`\`\`
|
|
1188
|
-
|
|
1189
|
-
Fix errors, then remove \`--validate\` to create.
|
|
1190
|
-
|
|
1191
|
-
---
|
|
1192
|
-
|
|
1193
|
-
## Complete Example
|
|
1194
|
-
|
|
1195
|
-
\`\`\`bash
|
|
1196
|
-
pnpm wu:create \\
|
|
1197
|
-
--id WU-1234 \\
|
|
1198
|
-
--lane "Framework: CLI" \\
|
|
1199
|
-
--title "Add feature X" \\
|
|
1200
|
-
--description "Context: Users need X. Problem: X doesn't exist. Solution: Add X." \\
|
|
1201
|
-
--acceptance "Feature X works as specified" \\
|
|
1202
|
-
--acceptance "Unit tests pass with >90% coverage" \\
|
|
1203
|
-
--code-paths "packages/@lumenflow/cli/src/x.ts" \\
|
|
1204
|
-
--test-paths-unit "packages/@lumenflow/cli/__tests__/x.test.ts" \\
|
|
1205
|
-
--exposure backend-only \\
|
|
1206
|
-
--spec-refs "~/.lumenflow/plans/WU-1234-plan.md"
|
|
1207
|
-
\`\`\`
|
|
1208
|
-
|
|
1209
|
-
---
|
|
1210
|
-
|
|
1211
|
-
## Common Errors
|
|
1212
|
-
|
|
1213
|
-
### "Lane format invalid"
|
|
1214
|
-
|
|
1215
|
-
**Cause:** Missing colon or space in lane format.
|
|
1216
|
-
|
|
1217
|
-
**Fix:** Use \`"Parent: Sublane"\` format (colon + space).
|
|
1218
|
-
|
|
1219
|
-
### "Missing required field"
|
|
1220
|
-
|
|
1221
|
-
**Cause:** Required field not provided.
|
|
1222
|
-
|
|
1223
|
-
**Fix:** Add the missing \`--field\` argument.
|
|
1224
|
-
|
|
1225
|
-
### "WU already exists"
|
|
1226
|
-
|
|
1227
|
-
**Cause:** WU with this ID already exists.
|
|
1228
|
-
|
|
1229
|
-
**Fix:** Use a different ID or check existing WUs.
|
|
1230
|
-
|
|
1231
|
-
---
|
|
1232
|
-
|
|
1233
|
-
## After Creation
|
|
1234
|
-
|
|
1235
|
-
1. Review the created YAML: \`cat {{DOCS_TASKS_PATH}}/wu/WU-XXX.yaml\`
|
|
1236
|
-
2. Claim the WU: \`pnpm wu:claim --id WU-XXX --lane "Lane"\`
|
|
1237
|
-
3. cd to worktree: \`cd worktrees/<lane>-wu-xxx\`
|
|
1238
|
-
`;
|
|
1239
|
-
// WU-1309: First 15 Minutes template
|
|
1240
|
-
export const FIRST_15_MINS_TEMPLATE = `# First 15 Minutes with LumenFlow
|
|
1241
|
-
|
|
1242
|
-
**Last updated:** {{DATE}}
|
|
1243
|
-
|
|
1244
|
-
A quick-start guide for your first session with LumenFlow.
|
|
1245
|
-
|
|
1246
|
-
---
|
|
1247
|
-
|
|
1248
|
-
## Minute 0-2: Verify Setup
|
|
1249
|
-
|
|
1250
|
-
\`\`\`bash
|
|
1251
|
-
# Check LumenFlow is configured
|
|
1252
|
-
ls LUMENFLOW.md AGENTS.md .lumenflow.config.yaml
|
|
1253
|
-
|
|
1254
|
-
# Run doctor to verify safety components
|
|
1255
|
-
pnpm exec lumenflow doctor
|
|
1256
|
-
\`\`\`
|
|
1257
|
-
|
|
1258
|
-
---
|
|
1259
|
-
|
|
1260
|
-
## Minute 2-5: Read Essential Docs
|
|
1261
|
-
|
|
1262
|
-
1. Open **LUMENFLOW.md** - Main workflow guide
|
|
1263
|
-
2. Scan **AGENTS.md** - Quick reference for commands
|
|
1264
|
-
3. Review **.lumenflow/constraints.md** - The 6 rules you must follow
|
|
1265
|
-
|
|
1266
|
-
---
|
|
1267
|
-
|
|
1268
|
-
## Minute 5-8: Find a WU to Work On
|
|
1269
|
-
|
|
1270
|
-
\`\`\`bash
|
|
1271
|
-
# Check status board
|
|
1272
|
-
cat {{DOCS_TASKS_PATH}}/status.md
|
|
1273
|
-
|
|
1274
|
-
# List ready WUs
|
|
1275
|
-
ls {{DOCS_TASKS_PATH}}/wu/*.yaml | head -5
|
|
1276
|
-
\`\`\`
|
|
1277
|
-
|
|
1278
|
-
---
|
|
1279
|
-
|
|
1280
|
-
## Minute 8-12: Claim and Start
|
|
1281
|
-
|
|
1282
|
-
\`\`\`bash
|
|
1283
|
-
# Claim a WU
|
|
1284
|
-
pnpm wu:claim --id WU-XXX --lane "Framework: Core"
|
|
1285
|
-
|
|
1286
|
-
# IMPORTANT: cd to worktree immediately
|
|
1287
|
-
cd worktrees/framework-core-wu-xxx
|
|
1288
|
-
|
|
1289
|
-
# Verify you're in the right place
|
|
1290
|
-
pwd # Should end with worktrees/...
|
|
1291
|
-
\`\`\`
|
|
1292
|
-
|
|
1293
|
-
---
|
|
1294
|
-
|
|
1295
|
-
## Minute 12-15: Begin TDD Cycle
|
|
1296
|
-
|
|
1297
|
-
\`\`\`bash
|
|
1298
|
-
# 1. Write a failing test
|
|
1299
|
-
# 2. Run it to confirm RED
|
|
1300
|
-
pnpm test -- --run
|
|
1301
|
-
|
|
1302
|
-
# 3. Write minimal code to pass
|
|
1303
|
-
# 4. Run test again for GREEN
|
|
1304
|
-
pnpm test -- --run
|
|
1305
|
-
|
|
1306
|
-
# 5. Run gates to check everything
|
|
1307
|
-
pnpm gates
|
|
1308
|
-
\`\`\`
|
|
1309
|
-
|
|
1310
|
-
---
|
|
1311
|
-
|
|
1312
|
-
## Key Reminders
|
|
1313
|
-
|
|
1314
|
-
- **Stay in the worktree** after claiming
|
|
1315
|
-
- **TDD**: Test first, then code
|
|
1316
|
-
- **Gates before done**: Always run \`pnpm gates\`
|
|
1317
|
-
- **Always wu:done**: Never forget to complete
|
|
1318
|
-
|
|
1319
|
-
---
|
|
1320
|
-
|
|
1321
|
-
## When Done
|
|
1322
|
-
|
|
1323
|
-
\`\`\`bash
|
|
1324
|
-
# From worktree: run gates
|
|
1325
|
-
pnpm gates
|
|
1326
|
-
|
|
1327
|
-
# From main: complete WU
|
|
1328
|
-
cd <project-root>
|
|
1329
|
-
pnpm wu:done --id WU-XXX
|
|
1330
|
-
\`\`\`
|
|
1331
|
-
`;
|
|
1332
|
-
// WU-1309: Local-only / no remote template
|
|
1333
|
-
export const LOCAL_ONLY_TEMPLATE = `# Local-Only Development
|
|
1334
|
-
|
|
1335
|
-
**Last updated:** {{DATE}}
|
|
1336
|
-
|
|
1337
|
-
Configure LumenFlow for local development without a remote repository.
|
|
1338
|
-
|
|
1339
|
-
---
|
|
1340
|
-
|
|
1341
|
-
## When to Use
|
|
1342
|
-
|
|
1343
|
-
- Air-gapped environments
|
|
1344
|
-
- Testing/evaluation
|
|
1345
|
-
- Pre-remote development (haven't pushed to GitHub yet)
|
|
1346
|
-
- Offline development
|
|
1347
|
-
|
|
1348
|
-
---
|
|
1349
|
-
|
|
1350
|
-
## Configuration
|
|
1351
|
-
|
|
1352
|
-
Add this to \`.lumenflow.config.yaml\`:
|
|
1353
|
-
|
|
1354
|
-
\`\`\`yaml
|
|
1355
|
-
git:
|
|
1356
|
-
requireRemote: false
|
|
1357
|
-
\`\`\`
|
|
1358
|
-
|
|
1359
|
-
---
|
|
1360
|
-
|
|
1361
|
-
## Behavior Changes
|
|
1362
|
-
|
|
1363
|
-
When \`requireRemote: false\`:
|
|
1364
|
-
|
|
1365
|
-
| Command | Default Behavior | Local-Only Behavior |
|
|
1366
|
-
|---------|------------------|---------------------|
|
|
1367
|
-
| \`wu:create\` | Fetches origin/main | Skips remote fetch |
|
|
1368
|
-
| \`wu:claim\` | Pushes lane branch | Creates local branch only |
|
|
1369
|
-
| \`wu:done\` | Pushes to origin | Commits to local main |
|
|
1370
|
-
|
|
1371
|
-
---
|
|
1372
|
-
|
|
1373
|
-
## Warnings
|
|
1374
|
-
|
|
1375
|
-
With local-only mode:
|
|
1376
|
-
|
|
1377
|
-
1. **No remote visibility** - Team members can't see your WUs
|
|
1378
|
-
2. **No backup** - Work is only on your machine
|
|
1379
|
-
3. **Manual sync required** - When adding a remote later
|
|
1380
|
-
|
|
1381
|
-
---
|
|
1382
|
-
|
|
1383
|
-
## Transitioning to Remote
|
|
1384
|
-
|
|
1385
|
-
When you add an origin remote:
|
|
1386
|
-
|
|
1387
|
-
1. Update config: \`git.requireRemote: true\` or remove the setting
|
|
1388
|
-
2. Push your main branch: \`git push -u origin main\`
|
|
1389
|
-
3. Resume normal workflow
|
|
1390
|
-
|
|
1391
|
-
---
|
|
1392
|
-
|
|
1393
|
-
## Troubleshooting
|
|
1394
|
-
|
|
1395
|
-
### "No origin remote configured"
|
|
1396
|
-
|
|
1397
|
-
**Cause:** \`requireRemote: true\` (default) but no origin exists.
|
|
1398
|
-
|
|
1399
|
-
**Fix:** Add remote or set \`requireRemote: false\`:
|
|
1400
|
-
|
|
1401
|
-
\`\`\`bash
|
|
1402
|
-
# Option 1: Add remote
|
|
1403
|
-
git remote add origin <url>
|
|
1404
|
-
|
|
1405
|
-
# Option 2: Enable local-only mode
|
|
1406
|
-
echo "git:\\n requireRemote: false" >> .lumenflow.config.yaml
|
|
1407
|
-
\`\`\`
|
|
1408
|
-
`;
|
|
1409
|
-
// WU-1309: Lane Inference template
|
|
1410
|
-
export const LANE_INFERENCE_DOC_TEMPLATE = `# Lane Inference
|
|
1411
|
-
|
|
1412
|
-
**Last updated:** {{DATE}}
|
|
1413
|
-
|
|
1414
|
-
How LumenFlow determines which lane a WU belongs to.
|
|
1415
|
-
|
|
1416
|
-
---
|
|
1417
|
-
|
|
1418
|
-
## Lane Format
|
|
1419
|
-
|
|
1420
|
-
LumenFlow uses hierarchical lanes: \`"Parent: Sublane"\`
|
|
1421
|
-
|
|
1422
|
-
Examples:
|
|
1423
|
-
- \`"Framework: Core"\`
|
|
1424
|
-
- \`"Framework: CLI"\`
|
|
1425
|
-
- \`"Experience: UI"\`
|
|
1426
|
-
- \`"Operations: CI/CD"\`
|
|
1427
|
-
- \`"Content: Documentation"\`
|
|
1428
|
-
|
|
1429
|
-
---
|
|
1430
|
-
|
|
1431
|
-
## Lane Taxonomy File
|
|
1432
|
-
|
|
1433
|
-
Lanes are defined in \`.lumenflow.lane-inference.yaml\`:
|
|
1434
|
-
|
|
1435
|
-
\`\`\`yaml
|
|
1436
|
-
Framework:
|
|
1437
|
-
Core:
|
|
1438
|
-
description: 'Core library'
|
|
1439
|
-
code_paths:
|
|
1440
|
-
- 'packages/**/core/**'
|
|
1441
|
-
keywords:
|
|
1442
|
-
- 'core'
|
|
1443
|
-
- 'library'
|
|
1444
|
-
|
|
1445
|
-
CLI:
|
|
1446
|
-
description: 'CLI commands'
|
|
1447
|
-
code_paths:
|
|
1448
|
-
- 'packages/**/cli/**'
|
|
1449
|
-
- 'bin/**'
|
|
1450
|
-
keywords:
|
|
1451
|
-
- 'cli'
|
|
1452
|
-
- 'command'
|
|
1453
|
-
\`\`\`
|
|
1454
|
-
|
|
1455
|
-
---
|
|
1456
|
-
|
|
1457
|
-
## Auto-Inference
|
|
1458
|
-
|
|
1459
|
-
Use \`wu:infer-lane\` to suggest a lane based on code paths:
|
|
1460
|
-
|
|
1461
|
-
\`\`\`bash
|
|
1462
|
-
# Infer from WU code_paths
|
|
1463
|
-
pnpm wu:infer-lane --id WU-XXX
|
|
1464
|
-
|
|
1465
|
-
# Infer from manual inputs
|
|
1466
|
-
pnpm wu:infer-lane --paths "packages/@lumenflow/cli/**" --desc "Add CLI command"
|
|
1467
|
-
\`\`\`
|
|
1468
|
-
|
|
1469
|
-
---
|
|
1470
|
-
|
|
1471
|
-
## Lane Lifecycle Setup
|
|
1472
|
-
|
|
1473
|
-
Before creating delivery WUs, complete lane lifecycle:
|
|
1474
|
-
|
|
1475
|
-
\`\`\`bash
|
|
1476
|
-
pnpm lane:setup
|
|
1477
|
-
pnpm lane:validate
|
|
1478
|
-
pnpm lane:lock
|
|
1479
|
-
\`\`\`
|
|
1480
|
-
|
|
1481
|
-
Use \`pnpm lane:status\` to inspect current state.
|
|
1482
|
-
|
|
1483
|
-
---
|
|
1484
|
-
|
|
1485
|
-
## Common Issues
|
|
1486
|
-
|
|
1487
|
-
### "Lane format invalid"
|
|
1488
|
-
|
|
1489
|
-
**Cause:** Missing colon or space.
|
|
1490
|
-
|
|
1491
|
-
**Fix:** Use \`"Parent: Sublane"\` format (colon + space).
|
|
1492
|
-
|
|
1493
|
-
### "Sub-lane validation failed"
|
|
1494
|
-
|
|
1495
|
-
**Cause:** Lane lifecycle is not locked or taxonomy is missing.
|
|
1496
|
-
|
|
1497
|
-
**Fix:** Run lane lifecycle setup:
|
|
1498
|
-
|
|
1499
|
-
\`\`\`bash
|
|
1500
|
-
pnpm lane:setup
|
|
1501
|
-
pnpm lane:validate
|
|
1502
|
-
pnpm lane:lock
|
|
1503
|
-
\`\`\`
|
|
1504
|
-
|
|
1505
|
-
---
|
|
1506
|
-
|
|
1507
|
-
## Lane Health
|
|
1508
|
-
|
|
1509
|
-
Check lane configuration for issues:
|
|
1510
|
-
|
|
1511
|
-
\`\`\`bash
|
|
1512
|
-
pnpm lane:health
|
|
1513
|
-
\`\`\`
|
|
1514
|
-
|
|
1515
|
-
This detects:
|
|
1516
|
-
- Overlapping code paths between lanes
|
|
1517
|
-
- Code files not covered by UnsafeAny lane
|
|
1518
|
-
`;
|
|
1519
|
-
// WU-1385: WU sizing guide template for agent onboarding
|
|
1520
|
-
export const WU_SIZING_GUIDE_TEMPLATE = `# Work Unit Sizing & Strategy Guide
|
|
1521
|
-
|
|
1522
|
-
**Last updated:** {{DATE}}
|
|
1523
|
-
|
|
1524
|
-
**Purpose:** Decision framework for agents to determine execution strategy based on task complexity.
|
|
1525
|
-
|
|
1526
|
-
**Status:** Active — Thresholds are **mandatory limits**, not guidelines.
|
|
1527
|
-
|
|
1528
|
-
---
|
|
1529
|
-
|
|
1530
|
-
## Complexity Assessment Matrix
|
|
1531
|
-
|
|
1532
|
-
Before claiming a WU, estimate its "weight" using these heuristics.
|
|
1533
|
-
|
|
1534
|
-
| Complexity | Files | Tool Calls | Context Budget | Strategy |
|
|
1535
|
-
| :------------ | :---- | :--------- | :------------- | :------------------------------------------- |
|
|
1536
|
-
| **Simple** | <20 | <50 | <30% | **Single Session** (Tier 2 Context) |
|
|
1537
|
-
| **Medium** | 20-50 | 50-100 | 30-50% | **Checkpoint-Resume** (Standard Handoff) |
|
|
1538
|
-
| **Complex** | 50+ | 100+ | >50% | **Orchestrator-Worker** OR **Decomposition** |
|
|
1539
|
-
| **Oversized** | 100+ | 200+ | — | **MUST Split** (See Patterns below) |
|
|
1540
|
-
|
|
1541
|
-
**These thresholds are mandatory.** Exceeding them leads to context exhaustion and rule loss. Agents operate in context windows and tool calls, not clock time.
|
|
1542
|
-
|
|
1543
|
-
---
|
|
1544
|
-
|
|
1545
|
-
## Context Safety Triggers
|
|
1546
|
-
|
|
1547
|
-
If you hit ANY of these triggers during a session, you MUST checkpoint and spawn fresh:
|
|
1548
|
-
|
|
1549
|
-
- **Token Limit:** Context usage hits **50% (Warning)** or **80% (Critical)**.
|
|
1550
|
-
- **Tool Volume:** **50+ tool calls** in current session.
|
|
1551
|
-
- **File Volume:** **20+ files** modified in \`git status\`.
|
|
1552
|
-
- **Session Staleness:** Repeated redundant queries or forgotten context.
|
|
1553
|
-
|
|
1554
|
-
---
|
|
1555
|
-
|
|
1556
|
-
## Spawn Fresh, Don't Continue
|
|
1557
|
-
|
|
1558
|
-
**When approaching context limits, spawn a fresh agent instead of continuing after compaction.**
|
|
1559
|
-
|
|
1560
|
-
Context compaction causes agents to lose critical rules. The disciplined approach:
|
|
1561
|
-
|
|
1562
|
-
1. Checkpoint your progress: \`pnpm mem:checkpoint --wu WU-XXX\`
|
|
1563
|
-
2. Commit and push work
|
|
1564
|
-
3. Generate fresh agent prompt: \`pnpm wu:brief --id WU-XXX --client claude-code\`
|
|
1565
|
-
4. EXIT current session (do NOT continue after compaction)
|
|
1566
|
-
|
|
1567
|
-
---
|
|
1568
|
-
|
|
1569
|
-
## Splitting Patterns
|
|
1570
|
-
|
|
1571
|
-
When a WU is Oversized or Complex, split it using approved patterns:
|
|
1572
|
-
|
|
1573
|
-
- **Tracer Bullet**: WU-1 proves skeleton works, WU-2 implements real logic
|
|
1574
|
-
- **Layer Split**: WU-1 for ports/application, WU-2 for infrastructure
|
|
1575
|
-
- **UI/Logic Split**: WU-1 for backend, WU-2 for frontend
|
|
1576
|
-
- **Feature Flag**: WU-1 behind flag, WU-2 removes flag
|
|
1577
|
-
|
|
1578
|
-
---
|
|
1579
|
-
|
|
1580
|
-
## Quick Reference
|
|
1581
|
-
|
|
1582
|
-
| Scenario | Strategy | Action |
|
|
1583
|
-
| :---------------------------------- | :------------------ | :------------------------------------------- |
|
|
1584
|
-
| Bug fix, single file, <20 calls | Simple | Claim, fix, commit, \`wu:done\` |
|
|
1585
|
-
| Feature 50-100 calls, clear phases | Checkpoint-Resume | Phase 1 → checkpoint → Phase 2 → done |
|
|
1586
|
-
| Multi-domain, must land atomically | Orchestrator-Worker | Main agent coordinates, spawns sub-agents |
|
|
1587
|
-
| Large refactor 100+ calls | Feature Flag Split | WU-A: New behind flag → WU-B: Remove flag |
|
|
1588
|
-
|
|
1589
|
-
---
|
|
1590
|
-
|
|
1591
|
-
## Documentation-Only Exception
|
|
1592
|
-
|
|
1593
|
-
Documentation WUs (\`type: documentation\`) have relaxed file count thresholds:
|
|
1594
|
-
|
|
1595
|
-
| Complexity | Files (docs) | Tool Calls | Strategy |
|
|
1596
|
-
| :--------- | :----------- | :--------- | :---------------- |
|
|
1597
|
-
| **Simple** | <40 | <50 | Single Session |
|
|
1598
|
-
| **Medium** | 40-80 | 50-100 | Checkpoint-Resume |
|
|
1599
|
-
|
|
1600
|
-
**Applies when ALL true:**
|
|
1601
|
-
- WU \`type: documentation\`
|
|
1602
|
-
- Only modifies: \`docs/**\`, \`*.md\`
|
|
1603
|
-
- Does NOT touch code paths
|
|
1604
|
-
|
|
1605
|
-
---
|
|
1606
|
-
|
|
1607
|
-
For complete sizing guidance, see the canonical [wu-sizing-guide.md](https://lumenflow.dev/reference/wu-sizing-guide/) documentation.
|
|
1608
|
-
`;
|
|
1609
|
-
// WU-1083: Claude skills templates
|
|
1610
|
-
export const WU_LIFECYCLE_SKILL_TEMPLATE = `---
|
|
1611
|
-
name: wu-lifecycle
|
|
1612
|
-
description: Work Unit claim/block/done workflow automation.
|
|
1613
|
-
version: 1.0.0
|
|
1614
|
-
---
|
|
1615
|
-
|
|
1616
|
-
# WU Lifecycle Skill
|
|
1617
|
-
|
|
1618
|
-
## When to Use
|
|
1619
|
-
|
|
1620
|
-
Activate this skill when:
|
|
1621
|
-
|
|
1622
|
-
- Claiming a WU (\`pnpm wu:claim\`)
|
|
1623
|
-
- Blocking/unblocking WUs due to dependencies
|
|
1624
|
-
- Running \`wu:done\` completion workflow
|
|
1625
|
-
- Understanding WU state machine transitions
|
|
1626
|
-
|
|
1627
|
-
## State Machine
|
|
1628
|
-
|
|
1629
|
-
\`\`\`
|
|
1630
|
-
ready -> in_progress -> waiting/blocked -> done
|
|
1631
|
-
\`\`\`
|
|
1632
|
-
|
|
1633
|
-
## Core Commands
|
|
1634
|
-
|
|
1635
|
-
\`\`\`bash
|
|
1636
|
-
# Claim WU
|
|
1637
|
-
pnpm wu:claim --id WU-XXX --lane <lane>
|
|
1638
|
-
cd worktrees/<lane>-wu-xxx # IMMEDIATELY
|
|
1639
|
-
|
|
1640
|
-
# Complete WU (from main)
|
|
1641
|
-
cd ../..
|
|
1642
|
-
pnpm wu:done --id WU-XXX
|
|
1643
|
-
|
|
1644
|
-
# Block/Unblock
|
|
1645
|
-
pnpm wu:block --id WU-XXX --reason "..."
|
|
1646
|
-
pnpm wu:unblock --id WU-XXX
|
|
1647
|
-
|
|
1648
|
-
# Create (full spec)
|
|
1649
|
-
pnpm wu:create --id WU-999 --lane "Operations" --title "Add feature" \\
|
|
1650
|
-
--description "Context: ... Problem: ... Solution: ..." \\
|
|
1651
|
-
--acceptance "Feature works" --code-paths "src/a.ts" --validate
|
|
1652
|
-
\`\`\`
|
|
1653
|
-
|
|
1654
|
-
## wu:done Workflow
|
|
1655
|
-
|
|
1656
|
-
1. Runs gates in worktree
|
|
1657
|
-
2. Fast-forward merge to main
|
|
1658
|
-
3. Creates \`.lumenflow/stamps/WU-XXX.done\`
|
|
1659
|
-
4. Updates backlog.md + status.md
|
|
1660
|
-
5. Removes worktree
|
|
1661
|
-
|
|
1662
|
-
## Worktree Discipline
|
|
1663
|
-
|
|
1664
|
-
After \`wu:claim\`:
|
|
1665
|
-
|
|
1666
|
-
- \`cd worktrees/<lane>-wu-xxx\` immediately
|
|
1667
|
-
- Use relative paths (never absolute)
|
|
1668
|
-
- Main is read-only
|
|
1669
|
-
`;
|
|
1670
|
-
export const WORKTREE_DISCIPLINE_SKILL_TEMPLATE = `---
|
|
1671
|
-
name: worktree-discipline
|
|
1672
|
-
description: Prevents the "absolute path trap" in Write/Edit/Read tools.
|
|
1673
|
-
version: 1.0.0
|
|
1674
|
-
---
|
|
1675
|
-
|
|
1676
|
-
# Worktree Discipline: Absolute Path Trap Prevention
|
|
1677
|
-
|
|
1678
|
-
**Purpose**: Prevent AI agents from bypassing worktree isolation via absolute file paths.
|
|
1679
|
-
|
|
1680
|
-
## The Absolute Path Trap
|
|
1681
|
-
|
|
1682
|
-
**Problem**: AI agents using Write/Edit/Read tools can bypass worktree isolation by passing absolute paths. Even when your shell is in the worktree, absolute paths target the main checkout.
|
|
1683
|
-
|
|
1684
|
-
### Example
|
|
1685
|
-
|
|
1686
|
-
\`\`\`typescript
|
|
1687
|
-
// Shell: cd worktrees/operations-wu-427
|
|
1688
|
-
|
|
1689
|
-
// WRONG - Absolute path bypasses worktree
|
|
1690
|
-
Write({
|
|
1691
|
-
file_path: '/<user-home>/source/project/apps/web/src/validator.ts',
|
|
1692
|
-
content: '...',
|
|
1693
|
-
});
|
|
1694
|
-
// Result: Written to MAIN checkout, not worktree!
|
|
1695
|
-
|
|
1696
|
-
// RIGHT - Relative path respects worktree
|
|
1697
|
-
Write({
|
|
1698
|
-
file_path: 'apps/web/src/validator.ts',
|
|
1699
|
-
content: '...',
|
|
1700
|
-
});
|
|
1701
|
-
// Result: Written to worktree correctly
|
|
1702
|
-
\`\`\`
|
|
1703
|
-
|
|
1704
|
-
## Pre-Operation Checklist
|
|
1705
|
-
|
|
1706
|
-
**Before ANY Write/Edit/Read operation:**
|
|
1707
|
-
|
|
1708
|
-
1. **Verify working directory**:
|
|
1709
|
-
|
|
1710
|
-
\`\`\`bash
|
|
1711
|
-
pwd
|
|
1712
|
-
# Must show: .../worktrees/<lane>-wu-xxx
|
|
1713
|
-
\`\`\`
|
|
1714
|
-
|
|
1715
|
-
2. **Check file path format**:
|
|
1716
|
-
|
|
1717
|
-
| Pattern | Safe? | Example |
|
|
1718
|
-
| --------------------------------- | ----- | --------------------------- |
|
|
1719
|
-
| Starts with \`/<user-home>/\` | NO | \`/<user-home>/.../file.ts\` |
|
|
1720
|
-
| Contains full repo path | NO | \`/source/project/...\` |
|
|
1721
|
-
| Starts with package name | YES | \`apps/web/src/...\` |
|
|
1722
|
-
| Starts with \`./\` or \`../\` | YES | \`./src/lib/...\` |
|
|
1723
|
-
| Just filename | YES | \`README.md\` |
|
|
1724
|
-
|
|
1725
|
-
3. **Use relative paths for ALL file operations**
|
|
1726
|
-
|
|
1727
|
-
## Golden Rules
|
|
1728
|
-
|
|
1729
|
-
1. **Always verify pwd** before file operations
|
|
1730
|
-
2. **Never use absolute paths** in Write/Edit/Read tools
|
|
1731
|
-
3. **When in doubt, use relative paths**
|
|
1732
|
-
`;
|
|
1733
|
-
export const LUMENFLOW_GATES_SKILL_TEMPLATE = `---
|
|
1734
|
-
name: lumenflow-gates
|
|
1735
|
-
description: Quality gates troubleshooting (format, lint, typecheck, tests).
|
|
1736
|
-
version: 1.0.0
|
|
1737
|
-
---
|
|
1738
|
-
|
|
1739
|
-
# LumenFlow Gates Skill
|
|
1740
|
-
|
|
1741
|
-
## When to Use
|
|
1742
|
-
|
|
1743
|
-
Activate this skill when:
|
|
1744
|
-
|
|
1745
|
-
- \`pnpm gates\` fails with format, lint, or typecheck errors
|
|
1746
|
-
- Need to determine if failure is from your changes vs pre-existing
|
|
1747
|
-
- Debugging test failures or coverage issues
|
|
1748
|
-
- Deciding whether to use \`--skip-gates\` (emergency only)
|
|
1749
|
-
|
|
1750
|
-
## Gate Sequence
|
|
1751
|
-
|
|
1752
|
-
\`\`\`
|
|
1753
|
-
pnpm gates = format:check -> lint -> typecheck -> spec:linter -> tests
|
|
1754
|
-
\`\`\`
|
|
1755
|
-
|
|
1756
|
-
## Fix Patterns
|
|
1757
|
-
|
|
1758
|
-
| Gate | Auto-fix | Manual |
|
|
1759
|
-
| --------- | --------------- | ----------------------------------- |
|
|
1760
|
-
| Format | \`pnpm format\` | - |
|
|
1761
|
-
| Lint | \`pnpm lint:fix\` | Fix reported issues |
|
|
1762
|
-
| Typecheck | - | Fix type errors (first error first) |
|
|
1763
|
-
| Tests | - | Debug, fix mocks, update snapshots |
|
|
1764
|
-
|
|
1765
|
-
## Decision Tree
|
|
1766
|
-
|
|
1767
|
-
**Gate failed. Is it from YOUR changes?**
|
|
1768
|
-
|
|
1769
|
-
\`\`\`bash
|
|
1770
|
-
git checkout main && pnpm gates # Check main
|
|
1771
|
-
# Pass on main -> Your change caused it -> Fix it
|
|
1772
|
-
# Fail on main -> Pre-existing -> Consider --skip-gates
|
|
1773
|
-
\`\`\`
|
|
1774
|
-
|
|
1775
|
-
**Can you fix it?**
|
|
1776
|
-
|
|
1777
|
-
- In your \`code_paths\`, <=10 lines -> Fix in place
|
|
1778
|
-
- Different paths, >10 lines -> Create Bug WU
|
|
1779
|
-
|
|
1780
|
-
## Skip Gates (Emergency)
|
|
1781
|
-
|
|
1782
|
-
Only when pre-existing failures:
|
|
1783
|
-
|
|
1784
|
-
\`\`\`bash
|
|
1785
|
-
pnpm wu:done --id WU-XXX --skip-gates --reason "Pre-existing" --fix-wu WU-YYY
|
|
1786
|
-
\`\`\`
|
|
1787
|
-
|
|
1788
|
-
## Common Lint Fixes
|
|
1789
|
-
|
|
1790
|
-
\`\`\`
|
|
1791
|
-
no-explicit-any -> Add proper types
|
|
1792
|
-
no-unused-vars -> Remove or prefix with _
|
|
1793
|
-
no-restricted-paths -> Check hex boundaries
|
|
1794
|
-
exhaustive-deps -> Add missing dependencies
|
|
1795
|
-
\`\`\`
|
|
1796
|
-
|
|
1797
|
-
## Validation Commands
|
|
1798
|
-
|
|
1799
|
-
\`\`\`bash
|
|
1800
|
-
pnpm gates # All gates
|
|
1801
|
-
pnpm gates -- --docs-only # Docs WUs
|
|
1802
|
-
pnpm format # Fix formatting
|
|
1803
|
-
pnpm lint:fix # Fix lint issues
|
|
1804
|
-
pnpm typecheck # Check types
|
|
1805
|
-
\`\`\`
|
|
1806
|
-
`;
|
|
1807
|
-
/**
|
|
1808
|
-
* WU-1969: Shared exclusion list used by both the full GITIGNORE_TEMPLATE
|
|
1809
|
-
* (fresh init) and the merge path (existing .gitignore).
|
|
1810
|
-
*
|
|
1811
|
-
* Defined once so the two paths cannot drift.
|
|
1812
|
-
* Each entry has a `pattern` (substring to search for in existing content)
|
|
1813
|
-
* and a `line` (exact line to append when missing).
|
|
1814
|
-
*/
|
|
1815
|
-
export const REQUIRED_GITIGNORE_EXCLUSIONS = [
|
|
1816
|
-
{ pattern: 'node_modules', line: 'node_modules/' },
|
|
1817
|
-
{ pattern: '.lumenflow/telemetry', line: '.lumenflow/telemetry/' },
|
|
1818
|
-
{ pattern: '.lumenflow/flow.log', line: '.lumenflow/flow.log' },
|
|
1819
|
-
{ pattern: '.lumenflow/commands.log', line: '.lumenflow/commands.log' },
|
|
1820
|
-
{ pattern: '.lumenflow/sessions/', line: '.lumenflow/sessions/' },
|
|
1821
|
-
{ pattern: '.lumenflow/memory/', line: '.lumenflow/memory/' },
|
|
1822
|
-
{ pattern: '.logs/', line: '.logs/' },
|
|
1823
|
-
{ pattern: 'worktrees', line: 'worktrees/' },
|
|
1824
|
-
];
|
|
1825
|
-
export const GITIGNORE_TEMPLATE = `# Dependencies
|
|
1826
|
-
node_modules/
|
|
1827
|
-
|
|
1828
|
-
# LumenFlow runtime state (local only, not shared)
|
|
1829
|
-
.lumenflow/telemetry/
|
|
1830
|
-
.lumenflow/flow.log
|
|
1831
|
-
.lumenflow/commands.log
|
|
1832
|
-
.lumenflow/sessions/
|
|
1833
|
-
.lumenflow/memory/
|
|
1834
|
-
|
|
1835
|
-
# WU-1852: Gates output logs (generated by wu:done/wu:prep)
|
|
1836
|
-
.logs/
|
|
1837
|
-
|
|
1838
|
-
# Worktrees (isolated parallel work directories)
|
|
1839
|
-
worktrees/
|
|
1840
|
-
|
|
1841
|
-
# Build output
|
|
1842
|
-
dist/
|
|
1843
|
-
*.tsbuildinfo
|
|
1844
|
-
|
|
1845
|
-
# Turbo
|
|
1846
|
-
.turbo/
|
|
1847
|
-
|
|
1848
|
-
# Environment files
|
|
1849
|
-
.env
|
|
1850
|
-
.env.local
|
|
1851
|
-
.env.*.local
|
|
1852
|
-
|
|
1853
|
-
# IDE
|
|
1854
|
-
.idea/
|
|
1855
|
-
.vscode/
|
|
1856
|
-
*.swp
|
|
1857
|
-
*.swo
|
|
1858
|
-
|
|
1859
|
-
# OS files
|
|
1860
|
-
.DS_Store
|
|
1861
|
-
Thumbs.db
|
|
1862
|
-
`;
|
|
1863
|
-
export const PRETTIERIGNORE_TEMPLATE = `# Dependencies
|
|
1864
|
-
node_modules/
|
|
1865
|
-
|
|
1866
|
-
# Build output
|
|
1867
|
-
dist/
|
|
1868
|
-
*.tsbuildinfo
|
|
1869
|
-
|
|
1870
|
-
# Coverage reports
|
|
1871
|
-
coverage/
|
|
1872
|
-
|
|
1873
|
-
# Turbo
|
|
1874
|
-
.turbo/
|
|
1875
|
-
|
|
1876
|
-
# LumenFlow state (local only)
|
|
1877
|
-
.lumenflow/state/
|
|
1878
|
-
|
|
1879
|
-
# Worktrees
|
|
1880
|
-
worktrees/
|
|
1881
|
-
|
|
1882
|
-
# Lockfiles (auto-generated)
|
|
1883
|
-
pnpm-lock.yaml
|
|
1884
|
-
package-lock.json
|
|
1885
|
-
yarn.lock
|
|
1886
|
-
|
|
1887
|
-
# Environment files
|
|
1888
|
-
.env
|
|
1889
|
-
.env.local
|
|
1890
|
-
.env.*.local
|
|
1891
|
-
`;
|
|
1892
|
-
export const SCRIPT_ARG_OVERRIDES = {
|
|
1893
|
-
'gates:docs': 'gates --docs-only',
|
|
1894
|
-
};
|
|
1895
|
-
export const SAFE_GIT_TEMPLATE = `#!/bin/sh
|
|
1896
|
-
#
|
|
1897
|
-
# safe-git - LumenFlow safety wrapper for git
|
|
1898
|
-
#
|
|
1899
|
-
# Blocks dangerous operations that can corrupt agent state.
|
|
1900
|
-
# For all other commands, passes through to system git.
|
|
1901
|
-
#
|
|
1902
|
-
|
|
1903
|
-
set -e
|
|
1904
|
-
|
|
1905
|
-
# Block 'worktree remove'
|
|
1906
|
-
if [ "$1" = "worktree" ] && [ "$2" = "remove" ]; then
|
|
1907
|
-
echo "" >&2
|
|
1908
|
-
echo "=== LUMENFLOW SAFETY BLOCK ===" >&2
|
|
1909
|
-
echo "" >&2
|
|
1910
|
-
echo "BLOCKED: Manual 'git worktree remove' is unsafe in this environment." >&2
|
|
1911
|
-
echo "" >&2
|
|
1912
|
-
echo "REASON: Manual removal leaves orphan directories and corrupts agent state." >&2
|
|
1913
|
-
echo "" >&2
|
|
1914
|
-
echo "USE INSTEAD:" >&2
|
|
1915
|
-
echo " pnpm wu:done --id <ID> (To complete a task)" >&2
|
|
1916
|
-
echo " pnpm wu:cleanup --id <ID> (To discard a task)" >&2
|
|
1917
|
-
echo "==============================" >&2
|
|
1918
|
-
exit 1
|
|
1919
|
-
fi
|
|
1920
|
-
|
|
1921
|
-
# Pass through to real git
|
|
1922
|
-
exec git "$@"
|
|
1923
|
-
`;
|
|
1924
|
-
export const PRE_COMMIT_TEMPLATE = `#!/bin/sh
|
|
1925
|
-
#
|
|
1926
|
-
# LumenFlow Pre-Commit Hook
|
|
1927
|
-
#
|
|
1928
|
-
# Enforces worktree discipline by blocking direct commits to main/master.
|
|
1929
|
-
# Does NOT assume pnpm test or UnsafeAny other commands exist.
|
|
1930
|
-
#
|
|
1931
|
-
# Rules:
|
|
1932
|
-
# 1. BLOCK commits to main/master (use WU workflow instead)
|
|
1933
|
-
# 2. ALLOW commits on lane branches (lane/*/wu-*)
|
|
1934
|
-
# 3. ALLOW commits on tmp/* branches (CLI micro-worktrees)
|
|
1935
|
-
#
|
|
1936
|
-
|
|
1937
|
-
# Skip on tmp/* branches (CLI micro-worktrees)
|
|
1938
|
-
BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
|
|
1939
|
-
case "$BRANCH" in tmp/*) exit 0 ;; esac
|
|
1940
|
-
|
|
1941
|
-
# Check for force bypass
|
|
1942
|
-
if [ "$LUMENFLOW_FORCE" = "1" ]; then
|
|
1943
|
-
exit 0
|
|
1944
|
-
fi
|
|
1945
|
-
|
|
1946
|
-
# Block direct commits to main/master
|
|
1947
|
-
case "$BRANCH" in
|
|
1948
|
-
main|master)
|
|
1949
|
-
echo "" >&2
|
|
1950
|
-
echo "=== DIRECT COMMIT TO \${BRANCH} BLOCKED ===" >&2
|
|
1951
|
-
echo "" >&2
|
|
1952
|
-
echo "LumenFlow protects main from direct commits." >&2
|
|
1953
|
-
echo "" >&2
|
|
1954
|
-
echo "USE INSTEAD:" >&2
|
|
1955
|
-
echo " pnpm wu:claim --id WU-XXXX --lane \\"<Lane>\\"" >&2
|
|
1956
|
-
echo " cd worktrees/<lane>-wu-xxxx" >&2
|
|
1957
|
-
echo " # Make commits in the worktree" >&2
|
|
1958
|
-
echo "" >&2
|
|
1959
|
-
echo "EMERGENCY BYPASS (logged):" >&2
|
|
1960
|
-
echo " LUMENFLOW_FORCE=1 git commit ..." >&2
|
|
1961
|
-
echo "==========================================" >&2
|
|
1962
|
-
exit 1
|
|
1963
|
-
;;
|
|
1964
|
-
esac
|
|
1965
|
-
|
|
1966
|
-
# Allow commits on other branches
|
|
1967
|
-
exit 0
|
|
1968
|
-
`;
|
|
1969
|
-
export const GATE_STUB_SCRIPTS = {
|
|
1970
|
-
'spec:linter': 'echo "[lumenflow] spec:linter stub -- install a WU spec linter or replace this script" && exit 0',
|
|
1971
|
-
lint: 'echo "[lumenflow] lint stub -- add ESLint or your preferred linter to enable this gate (e.g. eslint .)" && exit 0',
|
|
1972
|
-
typecheck: 'echo "[lumenflow] typecheck stub -- add TypeScript or your type checker to enable this gate (e.g. tsc --noEmit)" && exit 0',
|
|
1973
|
-
// WU-1747: format and format:check stubs that auto-detect prettier availability.
|
|
1974
|
-
// When prettier is installed (after pnpm install), they run prettier directly.
|
|
1975
|
-
// When prettier is not installed, they exit 0 with guidance -- matching other gate stubs.
|
|
1976
|
-
format: 'if command -v prettier >/dev/null 2>&1; then prettier --write .; else echo "[lumenflow] format stub -- install prettier to enable formatting (pnpm install)"; fi',
|
|
1977
|
-
'format:check': 'if command -v prettier >/dev/null 2>&1; then prettier --check .; else echo "[lumenflow] format:check stub -- install prettier to enable this gate (pnpm install)"; fi',
|
|
1978
|
-
// WU-1852: cos:gates no-op stub so fresh projects can complete wu:done without manual setup.
|
|
1979
|
-
// wu:done unconditionally runs `pnpm cos:gates`; without this stub the command fails.
|
|
1980
|
-
'cos:gates': 'echo "[lumenflow] cos:gates stub -- add COS governance rules or replace this script" && exit 0',
|
|
1981
|
-
};
|
|
1982
|
-
//# sourceMappingURL=init-templates.js.map
|