shift-ax 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.ko.md +145 -0
- package/README.md +143 -0
- package/dist/adapters/claude-code/adapter.js +90 -0
- package/dist/adapters/codex/adapter.js +94 -0
- package/dist/adapters/contracts.js +7 -0
- package/dist/adapters/index.js +12 -0
- package/dist/core/context/context-bundle.js +300 -0
- package/dist/core/context/discovery.js +82 -0
- package/dist/core/context/global-index-authoring.js +199 -0
- package/dist/core/context/global-knowledge-updates.js +116 -0
- package/dist/core/context/glossary.js +73 -0
- package/dist/core/context/guided-onboarding.js +233 -0
- package/dist/core/context/index-authoring.js +47 -0
- package/dist/core/context/index-resolver.js +78 -0
- package/dist/core/context/onboarding.js +186 -0
- package/dist/core/diagnostics/doctor.js +154 -0
- package/dist/core/finalization/commit-message.js +76 -0
- package/dist/core/finalization/commit-workflow.js +131 -0
- package/dist/core/memory/consolidation.js +99 -0
- package/dist/core/memory/decision-register.js +141 -0
- package/dist/core/memory/entity-memory.js +25 -0
- package/dist/core/memory/learned-debug.js +52 -0
- package/dist/core/memory/summary-checkpoints.js +9 -0
- package/dist/core/memory/thread-promotion.js +22 -0
- package/dist/core/memory/threads.js +66 -0
- package/dist/core/memory/topic-recall.js +52 -0
- package/dist/core/observability/context-health.js +15 -0
- package/dist/core/observability/context-monitor.js +29 -0
- package/dist/core/observability/state-handoff.js +78 -0
- package/dist/core/observability/topic-status.js +40 -0
- package/dist/core/observability/topics-status.js +26 -0
- package/dist/core/observability/verification-debt.js +82 -0
- package/dist/core/planning/brainstorm.js +120 -0
- package/dist/core/planning/escalation.js +69 -0
- package/dist/core/planning/execution-handoff.js +61 -0
- package/dist/core/planning/execution-launch.js +156 -0
- package/dist/core/planning/execution-orchestrator.js +87 -0
- package/dist/core/planning/feedback-reactions.js +75 -0
- package/dist/core/planning/lifecycle-events.js +45 -0
- package/dist/core/planning/plan-review.js +76 -0
- package/dist/core/planning/policy-context-sync.js +154 -0
- package/dist/core/planning/request-pipeline.js +386 -0
- package/dist/core/planning/workflow-state.js +18 -0
- package/dist/core/policies/project-profile.js +28 -0
- package/dist/core/policies/team-preferences.js +17 -0
- package/dist/core/review/aggregate-reviews.js +129 -0
- package/dist/core/review/run-lanes.js +376 -0
- package/dist/core/settings/global-context-home.js +28 -0
- package/dist/core/settings/project-settings.js +37 -0
- package/dist/core/shell/platform-shell.js +144 -0
- package/dist/core/topics/bootstrap.js +119 -0
- package/dist/core/topics/topic-artifacts.js +36 -0
- package/dist/core/topics/worktree-runtime.js +141 -0
- package/dist/core/topics/worktree.js +8 -0
- package/dist/platform/claude-code/bootstrap.js +66 -0
- package/dist/platform/claude-code/execution.js +157 -0
- package/dist/platform/claude-code/scaffold/CLAUDE.template.md +40 -0
- package/dist/platform/claude-code/scaffold/commands/doctor.template.md +11 -0
- package/dist/platform/claude-code/scaffold/commands/export-context.template.md +20 -0
- package/dist/platform/claude-code/scaffold/commands/onboard.template.md +43 -0
- package/dist/platform/claude-code/scaffold/commands/onboarding.template.md +43 -0
- package/dist/platform/claude-code/scaffold/commands/request.template.md +19 -0
- package/dist/platform/claude-code/scaffold/commands/resume.template.md +12 -0
- package/dist/platform/claude-code/scaffold/commands/review.template.md +10 -0
- package/dist/platform/claude-code/scaffold/commands/status.template.md +14 -0
- package/dist/platform/claude-code/scaffold/commands/topics.template.md +10 -0
- package/dist/platform/claude-code/scaffold/hooks/shift-ax-session-start.template.md +29 -0
- package/dist/platform/claude-code/tmux.js +35 -0
- package/dist/platform/claude-code/upstream/tmux/imported/detached-session.js +40 -0
- package/dist/platform/claude-code/upstream/tmux/imported/session-name.js +19 -0
- package/dist/platform/claude-code/upstream/worktree/imported/get-worktree-root.js +39 -0
- package/dist/platform/claude-code/upstream/worktree/imported/managed-worktree.js +77 -0
- package/dist/platform/claude-code/worktree.js +79 -0
- package/dist/platform/codex/bootstrap.js +69 -0
- package/dist/platform/codex/execution.js +163 -0
- package/dist/platform/codex/scaffold/AGENTS.template.md +40 -0
- package/dist/platform/codex/scaffold/prompts/doctor.template.md +11 -0
- package/dist/platform/codex/scaffold/prompts/export-context.template.md +20 -0
- package/dist/platform/codex/scaffold/prompts/onboard.template.md +43 -0
- package/dist/platform/codex/scaffold/prompts/onboarding.template.md +43 -0
- package/dist/platform/codex/scaffold/prompts/request.template.md +19 -0
- package/dist/platform/codex/scaffold/prompts/resume.template.md +14 -0
- package/dist/platform/codex/scaffold/prompts/review.template.md +10 -0
- package/dist/platform/codex/scaffold/prompts/shift-ax-bootstrap.template.md +23 -0
- package/dist/platform/codex/scaffold/prompts/status.template.md +14 -0
- package/dist/platform/codex/scaffold/prompts/topics.template.md +10 -0
- package/dist/platform/codex/scaffold/skills/doctor/SKILL.template.md +11 -0
- package/dist/platform/codex/scaffold/skills/export-context/SKILL.template.md +20 -0
- package/dist/platform/codex/scaffold/skills/onboard/SKILL.template.md +43 -0
- package/dist/platform/codex/scaffold/skills/request/SKILL.template.md +19 -0
- package/dist/platform/codex/scaffold/skills/resume/SKILL.template.md +14 -0
- package/dist/platform/codex/scaffold/skills/review/SKILL.template.md +10 -0
- package/dist/platform/codex/scaffold/skills/status/SKILL.template.md +14 -0
- package/dist/platform/codex/scaffold/skills/topics/SKILL.template.md +10 -0
- package/dist/platform/codex/tmux.js +45 -0
- package/dist/platform/codex/upstream/tmux/imported/resize-hook-registration.js +37 -0
- package/dist/platform/codex/upstream/tmux/imported/resize-hooks.js +29 -0
- package/dist/platform/codex/upstream/tmux/imported/sanitize-team-name.js +18 -0
- package/dist/platform/codex/upstream/worktree/imported/managed-worktree.js +208 -0
- package/dist/platform/codex/upstream/worktree/imported/resolve-repo-root.js +14 -0
- package/dist/platform/codex/worktree.js +99 -0
- package/dist/platform/index.js +10 -0
- package/dist/platform/product-shell-commands.js +17 -0
- package/dist/platform/scaffold.js +16 -0
- package/dist/platform/upstream-imports.js +5 -0
- package/dist/scripts/ax-approve-plan.js +30 -0
- package/dist/scripts/ax-bootstrap-assets.js +19 -0
- package/dist/scripts/ax-bootstrap-topic.js +24 -0
- package/dist/scripts/ax-build-context-bundle.js +35 -0
- package/dist/scripts/ax-checkpoint-context.js +22 -0
- package/dist/scripts/ax-consolidate-memory.js +7 -0
- package/dist/scripts/ax-context-health.js +26 -0
- package/dist/scripts/ax-decisions.js +32 -0
- package/dist/scripts/ax-doctor.js +25 -0
- package/dist/scripts/ax-entity-memory.js +19 -0
- package/dist/scripts/ax-export-context.js +8 -0
- package/dist/scripts/ax-finalize-commit.js +23 -0
- package/dist/scripts/ax-init-context.js +41 -0
- package/dist/scripts/ax-launch-execution.js +24 -0
- package/dist/scripts/ax-learned-debug-save.js +30 -0
- package/dist/scripts/ax-learned-debug.js +12 -0
- package/dist/scripts/ax-monitor-context.js +28 -0
- package/dist/scripts/ax-onboard-context.js +112 -0
- package/dist/scripts/ax-pause-work.js +33 -0
- package/dist/scripts/ax-platform-manifest.js +19 -0
- package/dist/scripts/ax-promote-thread.js +20 -0
- package/dist/scripts/ax-react-feedback.js +28 -0
- package/dist/scripts/ax-recall-topics.js +20 -0
- package/dist/scripts/ax-recall.js +58 -0
- package/dist/scripts/ax-refresh-state.js +15 -0
- package/dist/scripts/ax-resolve-context.js +34 -0
- package/dist/scripts/ax-review.js +24 -0
- package/dist/scripts/ax-run-request.js +198 -0
- package/dist/scripts/ax-scaffold-build.js +19 -0
- package/dist/scripts/ax-shell.js +123 -0
- package/dist/scripts/ax-sync-policy-context.js +40 -0
- package/dist/scripts/ax-team-preferences.js +20 -0
- package/dist/scripts/ax-thread-save.js +26 -0
- package/dist/scripts/ax-threads.js +11 -0
- package/dist/scripts/ax-topic-status.js +18 -0
- package/dist/scripts/ax-topics-status.js +22 -0
- package/dist/scripts/ax-verification-debt.js +22 -0
- package/dist/scripts/ax-worktree-create.js +22 -0
- package/dist/scripts/ax-worktree-plan.js +18 -0
- package/dist/scripts/ax-worktree-remove.js +18 -0
- package/dist/scripts/ax.js +132 -0
- package/package.json +71 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { writeContextBundle } from '../core/context/context-bundle.js';
|
|
3
|
+
function usage() {
|
|
4
|
+
process.stderr.write('Usage: ax-init-context [--root DIR] [--topic DIR] --query "<text>" [--max-chars N] [--output PATH]\n');
|
|
5
|
+
}
|
|
6
|
+
function readArg(flag) {
|
|
7
|
+
const index = process.argv.indexOf(flag);
|
|
8
|
+
if (index === -1)
|
|
9
|
+
return undefined;
|
|
10
|
+
return process.argv[index + 1];
|
|
11
|
+
}
|
|
12
|
+
const rootDir = readArg('--root');
|
|
13
|
+
const topicDir = readArg('--topic');
|
|
14
|
+
const query = readArg('--query');
|
|
15
|
+
const outputPath = readArg('--output');
|
|
16
|
+
const workflowStep = readArg('--workflow-step') || 'general';
|
|
17
|
+
const maxChars = Number(readArg('--max-chars') || '6000');
|
|
18
|
+
if (!query || (!rootDir && !topicDir)) {
|
|
19
|
+
usage();
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
const result = await writeContextBundle({
|
|
23
|
+
...(rootDir ? { rootDir } : {}),
|
|
24
|
+
...(topicDir ? { topicDir } : {}),
|
|
25
|
+
query,
|
|
26
|
+
...(outputPath ? { outputPath } : {}),
|
|
27
|
+
workflowStep,
|
|
28
|
+
maxChars: Number.isFinite(maxChars) && maxChars > 0 ? maxChars : 6000,
|
|
29
|
+
});
|
|
30
|
+
process.stdout.write(`${JSON.stringify({
|
|
31
|
+
query: result.bundle.query,
|
|
32
|
+
workflow_step: workflowStep,
|
|
33
|
+
status: result.status,
|
|
34
|
+
issues_count: result.bundle.issues.length,
|
|
35
|
+
max_chars: result.bundle.max_chars,
|
|
36
|
+
sections: result.bundle.sections.map((section) => ({
|
|
37
|
+
kind: section.kind,
|
|
38
|
+
item_count: section.items.length,
|
|
39
|
+
})),
|
|
40
|
+
output_path: result.output_path,
|
|
41
|
+
}, null, 2)}\n`);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { getPlatformAdapter } from '../adapters/index.js';
|
|
3
|
+
function usage() {
|
|
4
|
+
process.stderr.write('Usage: ax-launch-execution --platform <codex|claude-code> --topic DIR [--task-id ID] [--dry-run]\n');
|
|
5
|
+
}
|
|
6
|
+
function readArg(flag) {
|
|
7
|
+
const index = process.argv.indexOf(flag);
|
|
8
|
+
if (index === -1)
|
|
9
|
+
return undefined;
|
|
10
|
+
return process.argv[index + 1];
|
|
11
|
+
}
|
|
12
|
+
const platform = readArg('--platform');
|
|
13
|
+
const topicDir = readArg('--topic');
|
|
14
|
+
const taskId = readArg('--task-id');
|
|
15
|
+
const dryRun = process.argv.includes('--dry-run');
|
|
16
|
+
if ((platform !== 'codex' && platform !== 'claude-code') || !topicDir) {
|
|
17
|
+
usage();
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
20
|
+
const adapter = getPlatformAdapter(platform);
|
|
21
|
+
const result = dryRun
|
|
22
|
+
? await adapter.planExecution({ topicDir, taskId })
|
|
23
|
+
: await adapter.launchExecution({ topicDir, taskId });
|
|
24
|
+
process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { recordLearnedDebugNote } from '../core/memory/learned-debug.js';
|
|
3
|
+
function usage() {
|
|
4
|
+
process.stderr.write('Usage: ax-learned-debug-save --root DIR --summary "<text>" --resolution "<text>" [--occurrences N] [--approved] [--fix-commit SHA]\n');
|
|
5
|
+
}
|
|
6
|
+
function readArg(flag) {
|
|
7
|
+
const index = process.argv.indexOf(flag);
|
|
8
|
+
if (index === -1)
|
|
9
|
+
return undefined;
|
|
10
|
+
return process.argv[index + 1];
|
|
11
|
+
}
|
|
12
|
+
const rootDir = readArg('--root') || process.cwd();
|
|
13
|
+
const summary = readArg('--summary');
|
|
14
|
+
const resolution = readArg('--resolution');
|
|
15
|
+
const occurrences = Number(readArg('--occurrences') || '1');
|
|
16
|
+
const approved = process.argv.includes('--approved');
|
|
17
|
+
const fixCommit = readArg('--fix-commit');
|
|
18
|
+
if (!summary || !resolution) {
|
|
19
|
+
usage();
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
const result = await recordLearnedDebugNote({
|
|
23
|
+
rootDir,
|
|
24
|
+
summary,
|
|
25
|
+
resolution,
|
|
26
|
+
occurrences: Number.isFinite(occurrences) ? occurrences : 1,
|
|
27
|
+
approved,
|
|
28
|
+
...(fixCommit ? { fixCommit } : {}),
|
|
29
|
+
});
|
|
30
|
+
process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { listLearnedDebugNotes } from '../core/memory/learned-debug.js';
|
|
3
|
+
function readArg(flag) {
|
|
4
|
+
const index = process.argv.indexOf(flag);
|
|
5
|
+
if (index === -1)
|
|
6
|
+
return undefined;
|
|
7
|
+
return process.argv[index + 1];
|
|
8
|
+
}
|
|
9
|
+
const rootDir = readArg('--root') || process.cwd();
|
|
10
|
+
const query = readArg('--query');
|
|
11
|
+
const result = await listLearnedDebugNotes({ rootDir, ...(query ? { query } : {}) });
|
|
12
|
+
process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { writeContextMonitorSnapshot } from '../core/observability/context-monitor.js';
|
|
3
|
+
function usage() {
|
|
4
|
+
process.stderr.write('Usage: ax-monitor-context [--root DIR] [--topic DIR] --query "<text>" [--max-chars N] [--output PATH]\n');
|
|
5
|
+
}
|
|
6
|
+
function readArg(flag) {
|
|
7
|
+
const index = process.argv.indexOf(flag);
|
|
8
|
+
if (index === -1)
|
|
9
|
+
return undefined;
|
|
10
|
+
return process.argv[index + 1];
|
|
11
|
+
}
|
|
12
|
+
const rootDir = readArg('--root');
|
|
13
|
+
const topicDir = readArg('--topic');
|
|
14
|
+
const query = readArg('--query');
|
|
15
|
+
const outputPath = readArg('--output');
|
|
16
|
+
const maxChars = Number(readArg('--max-chars') || '6000');
|
|
17
|
+
if (!query || (!rootDir && !topicDir)) {
|
|
18
|
+
usage();
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
21
|
+
const result = await writeContextMonitorSnapshot({
|
|
22
|
+
...(rootDir ? { rootDir } : {}),
|
|
23
|
+
...(topicDir ? { topicDir } : {}),
|
|
24
|
+
query,
|
|
25
|
+
...(outputPath ? { outputPath } : {}),
|
|
26
|
+
maxChars: Number.isFinite(maxChars) && maxChars > 0 ? maxChars : 6000,
|
|
27
|
+
});
|
|
28
|
+
process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { readFile } from 'node:fs/promises';
|
|
3
|
+
import { createInterface } from 'node:readline/promises';
|
|
4
|
+
import { stdin, stderr } from 'node:process';
|
|
5
|
+
import { onboardProjectContext, onboardProjectContextFromDiscovery, } from '../core/context/onboarding.js';
|
|
6
|
+
import { runGuidedOnboarding } from '../core/context/guided-onboarding.js';
|
|
7
|
+
import { readProjectSettings, writeProjectSettings } from '../core/settings/project-settings.js';
|
|
8
|
+
function usage() {
|
|
9
|
+
process.stderr.write('Usage: ax-onboard-context [--input FILE] [--discover] [--no-glossary] [--overwrite] [--lang en|ko] [--platform codex|claude-code] [--root DIR]\n');
|
|
10
|
+
}
|
|
11
|
+
function readArg(flag) {
|
|
12
|
+
const index = process.argv.indexOf(flag);
|
|
13
|
+
if (index === -1)
|
|
14
|
+
return undefined;
|
|
15
|
+
return process.argv[index + 1];
|
|
16
|
+
}
|
|
17
|
+
async function createPromptSession() {
|
|
18
|
+
const fallbackAnswers = !stdin.isTTY
|
|
19
|
+
? (await new Promise((resolve, reject) => {
|
|
20
|
+
let raw = '';
|
|
21
|
+
stdin.setEncoding('utf8');
|
|
22
|
+
stdin.on('data', (chunk) => {
|
|
23
|
+
raw += chunk;
|
|
24
|
+
});
|
|
25
|
+
stdin.on('end', () => resolve(raw));
|
|
26
|
+
stdin.on('error', reject);
|
|
27
|
+
}))
|
|
28
|
+
.split(/\r?\n/)
|
|
29
|
+
: null;
|
|
30
|
+
let fallbackIndex = 0;
|
|
31
|
+
const rl = stdin.isTTY
|
|
32
|
+
? createInterface({
|
|
33
|
+
input: stdin,
|
|
34
|
+
output: stderr,
|
|
35
|
+
})
|
|
36
|
+
: null;
|
|
37
|
+
return {
|
|
38
|
+
ask: async (question) => {
|
|
39
|
+
if (rl) {
|
|
40
|
+
return rl.question(question);
|
|
41
|
+
}
|
|
42
|
+
stderr.write(question);
|
|
43
|
+
const answer = fallbackAnswers?.[fallbackIndex] ?? '';
|
|
44
|
+
fallbackIndex += 1;
|
|
45
|
+
return answer;
|
|
46
|
+
},
|
|
47
|
+
close: () => rl?.close(),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
async function promptLocaleSelection(ask) {
|
|
51
|
+
const answer = (await ask('Choose language / 언어를 선택하세요:\n1. English (default)\n2. Korean\n> '))
|
|
52
|
+
.trim()
|
|
53
|
+
.toLowerCase();
|
|
54
|
+
return answer === '2' ? 'ko' : 'en';
|
|
55
|
+
}
|
|
56
|
+
async function main() {
|
|
57
|
+
const inputPath = readArg('--input');
|
|
58
|
+
const rootDir = readArg('--root') || process.cwd();
|
|
59
|
+
const discover = process.argv.includes('--discover');
|
|
60
|
+
const includeGlossary = !process.argv.includes('--no-glossary');
|
|
61
|
+
const overwrite = process.argv.includes('--overwrite');
|
|
62
|
+
const localeArg = readArg('--lang');
|
|
63
|
+
const platformArg = readArg('--platform');
|
|
64
|
+
const prompts = inputPath || discover || localeArg
|
|
65
|
+
? null
|
|
66
|
+
: await createPromptSession();
|
|
67
|
+
const locale = localeArg === 'ko' || localeArg === 'en'
|
|
68
|
+
? localeArg
|
|
69
|
+
: inputPath || discover
|
|
70
|
+
? 'en'
|
|
71
|
+
: await promptLocaleSelection(prompts.ask);
|
|
72
|
+
try {
|
|
73
|
+
const result = inputPath
|
|
74
|
+
? await onboardProjectContext({
|
|
75
|
+
...JSON.parse(await readFile(inputPath, 'utf8')),
|
|
76
|
+
rootDir,
|
|
77
|
+
overwrite,
|
|
78
|
+
})
|
|
79
|
+
: discover
|
|
80
|
+
? await onboardProjectContextFromDiscovery({ rootDir, includeGlossary, overwrite })
|
|
81
|
+
: await runGuidedOnboarding({
|
|
82
|
+
rootDir,
|
|
83
|
+
locale,
|
|
84
|
+
ask: prompts.ask,
|
|
85
|
+
});
|
|
86
|
+
if (platformArg === 'codex' || platformArg === 'claude-code' || localeArg === 'en' || localeArg === 'ko') {
|
|
87
|
+
const existing = await readProjectSettings(rootDir);
|
|
88
|
+
await writeProjectSettings({
|
|
89
|
+
rootDir,
|
|
90
|
+
settings: {
|
|
91
|
+
...(existing ?? {}),
|
|
92
|
+
version: 1,
|
|
93
|
+
updated_at: new Date().toISOString(),
|
|
94
|
+
locale: localeArg === 'en' || localeArg === 'ko' ? localeArg : existing?.locale ?? locale,
|
|
95
|
+
...(platformArg === 'codex' || platformArg === 'claude-code'
|
|
96
|
+
? { preferred_platform: platformArg }
|
|
97
|
+
: existing?.preferred_platform
|
|
98
|
+
? { preferred_platform: existing.preferred_platform }
|
|
99
|
+
: {}),
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
|
|
104
|
+
}
|
|
105
|
+
finally {
|
|
106
|
+
prompts?.close();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
void main().catch((error) => {
|
|
110
|
+
process.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`);
|
|
111
|
+
process.exit(1);
|
|
112
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { pauseTopicWork } from '../core/observability/state-handoff.js';
|
|
3
|
+
function usage() {
|
|
4
|
+
process.stderr.write('Usage: ax-pause-work --topic DIR --summary "<text>" [--next-step "<text>"] [--command "<text>"]...\n');
|
|
5
|
+
}
|
|
6
|
+
function readArg(flag) {
|
|
7
|
+
const index = process.argv.indexOf(flag);
|
|
8
|
+
if (index === -1)
|
|
9
|
+
return undefined;
|
|
10
|
+
return process.argv[index + 1];
|
|
11
|
+
}
|
|
12
|
+
function readArgs(flag) {
|
|
13
|
+
const values = [];
|
|
14
|
+
process.argv.forEach((arg, index) => {
|
|
15
|
+
if (arg === flag && process.argv[index + 1]) {
|
|
16
|
+
values.push(process.argv[index + 1]);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
return values;
|
|
20
|
+
}
|
|
21
|
+
const topicDir = readArg('--topic');
|
|
22
|
+
const summary = readArg('--summary');
|
|
23
|
+
if (!topicDir || !summary) {
|
|
24
|
+
usage();
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
27
|
+
const result = await pauseTopicWork({
|
|
28
|
+
topicDir,
|
|
29
|
+
summary,
|
|
30
|
+
nextStep: readArg('--next-step'),
|
|
31
|
+
commands: readArgs('--command'),
|
|
32
|
+
});
|
|
33
|
+
process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { getPlatformAdapter } from '../adapters/index.js';
|
|
3
|
+
function usage() {
|
|
4
|
+
process.stderr.write('Usage: ax-platform-manifest --platform <codex|claude-code> [--root DIR]\n');
|
|
5
|
+
}
|
|
6
|
+
function readArg(flag) {
|
|
7
|
+
const index = process.argv.indexOf(flag);
|
|
8
|
+
if (index === -1)
|
|
9
|
+
return undefined;
|
|
10
|
+
return process.argv[index + 1];
|
|
11
|
+
}
|
|
12
|
+
const platform = readArg('--platform');
|
|
13
|
+
const rootDir = readArg('--root') || process.cwd();
|
|
14
|
+
if (platform !== 'codex' && platform !== 'claude-code') {
|
|
15
|
+
usage();
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
const adapter = getPlatformAdapter(platform);
|
|
19
|
+
process.stdout.write(`${JSON.stringify(adapter.getManifest(rootDir), null, 2)}\n`);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { promoteThreadToTopic } from '../core/memory/thread-promotion.js';
|
|
3
|
+
function usage() {
|
|
4
|
+
process.stderr.write('Usage: ax-promote-thread --root DIR --name NAME --request "<text>"\n');
|
|
5
|
+
}
|
|
6
|
+
function readArg(flag) {
|
|
7
|
+
const index = process.argv.indexOf(flag);
|
|
8
|
+
if (index === -1)
|
|
9
|
+
return undefined;
|
|
10
|
+
return process.argv[index + 1];
|
|
11
|
+
}
|
|
12
|
+
const rootDir = readArg('--root') || process.cwd();
|
|
13
|
+
const name = readArg('--name');
|
|
14
|
+
const request = readArg('--request');
|
|
15
|
+
if (!name || !request) {
|
|
16
|
+
usage();
|
|
17
|
+
process.exit(1);
|
|
18
|
+
}
|
|
19
|
+
const result = await promoteThreadToTopic({ rootDir, name, request });
|
|
20
|
+
process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { applyFeedbackReaction } from '../core/planning/feedback-reactions.js';
|
|
3
|
+
function usage() {
|
|
4
|
+
process.stderr.write('Usage: ax-react-feedback --topic DIR --kind <review-changes-requested|ci-failed> --summary "<text>"\n');
|
|
5
|
+
}
|
|
6
|
+
function readArg(flag) {
|
|
7
|
+
const index = process.argv.indexOf(flag);
|
|
8
|
+
if (index === -1)
|
|
9
|
+
return undefined;
|
|
10
|
+
return process.argv[index + 1];
|
|
11
|
+
}
|
|
12
|
+
const topicDir = readArg('--topic');
|
|
13
|
+
const kind = readArg('--kind');
|
|
14
|
+
const summary = readArg('--summary');
|
|
15
|
+
if (!topicDir || !kind || !summary) {
|
|
16
|
+
usage();
|
|
17
|
+
process.exit(1);
|
|
18
|
+
}
|
|
19
|
+
if (kind !== 'review-changes-requested' && kind !== 'ci-failed') {
|
|
20
|
+
usage();
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
const result = await applyFeedbackReaction({
|
|
24
|
+
topicDir,
|
|
25
|
+
kind,
|
|
26
|
+
summary,
|
|
27
|
+
});
|
|
28
|
+
process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { searchPastTopics } from '../core/memory/topic-recall.js';
|
|
3
|
+
function usage() {
|
|
4
|
+
process.stderr.write('Usage: ax-recall-topics --query "<text>" [--root DIR] [--limit N]\n');
|
|
5
|
+
}
|
|
6
|
+
function readArg(flag) {
|
|
7
|
+
const index = process.argv.indexOf(flag);
|
|
8
|
+
if (index === -1)
|
|
9
|
+
return undefined;
|
|
10
|
+
return process.argv[index + 1];
|
|
11
|
+
}
|
|
12
|
+
const query = readArg('--query');
|
|
13
|
+
const rootDir = readArg('--root') || process.cwd();
|
|
14
|
+
const limit = Number.parseInt(readArg('--limit') || '5', 10);
|
|
15
|
+
if (!query) {
|
|
16
|
+
usage();
|
|
17
|
+
process.exit(1);
|
|
18
|
+
}
|
|
19
|
+
const result = await searchPastTopics({ rootDir, query, limit });
|
|
20
|
+
process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { searchDecisionMemory } from '../core/memory/decision-register.js';
|
|
3
|
+
import { searchPastTopics } from '../core/memory/topic-recall.js';
|
|
4
|
+
import { buildContextBundle } from '../core/context/context-bundle.js';
|
|
5
|
+
function usage() {
|
|
6
|
+
process.stderr.write('Usage: ax-recall --root DIR --scope <topic|decision|repo> --query "<text>" [--limit N]\n');
|
|
7
|
+
}
|
|
8
|
+
function readArg(flag) {
|
|
9
|
+
const index = process.argv.indexOf(flag);
|
|
10
|
+
if (index === -1)
|
|
11
|
+
return undefined;
|
|
12
|
+
return process.argv[index + 1];
|
|
13
|
+
}
|
|
14
|
+
const rootDir = readArg('--root') || process.cwd();
|
|
15
|
+
const scope = readArg('--scope');
|
|
16
|
+
const query = readArg('--query');
|
|
17
|
+
const limit = Number(readArg('--limit') || '5');
|
|
18
|
+
if (!scope || !query || !['topic', 'decision', 'repo'].includes(scope)) {
|
|
19
|
+
usage();
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
const normalizedLimit = Number.isFinite(limit) && limit > 0 ? limit : 5;
|
|
23
|
+
let result;
|
|
24
|
+
if (scope === 'topic') {
|
|
25
|
+
result = await searchPastTopics({
|
|
26
|
+
rootDir,
|
|
27
|
+
query,
|
|
28
|
+
limit: normalizedLimit,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
else if (scope === 'decision') {
|
|
32
|
+
result = await searchDecisionMemory({
|
|
33
|
+
rootDir,
|
|
34
|
+
query,
|
|
35
|
+
limit: normalizedLimit,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
const bundle = await buildContextBundle({
|
|
40
|
+
rootDir,
|
|
41
|
+
query,
|
|
42
|
+
maxChars: 3000,
|
|
43
|
+
});
|
|
44
|
+
result = {
|
|
45
|
+
base_context: bundle.sections.find((section) => section.kind === 'base_context')?.items ?? [],
|
|
46
|
+
topics: await searchPastTopics({
|
|
47
|
+
rootDir,
|
|
48
|
+
query,
|
|
49
|
+
limit: normalizedLimit,
|
|
50
|
+
}),
|
|
51
|
+
decisions: await searchDecisionMemory({
|
|
52
|
+
rootDir,
|
|
53
|
+
query,
|
|
54
|
+
limit: normalizedLimit,
|
|
55
|
+
}),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { writeRootStateSummary } from '../core/observability/state-handoff.js';
|
|
3
|
+
function readArg(flag) {
|
|
4
|
+
const index = process.argv.indexOf(flag);
|
|
5
|
+
if (index === -1)
|
|
6
|
+
return undefined;
|
|
7
|
+
return process.argv[index + 1];
|
|
8
|
+
}
|
|
9
|
+
const rootDir = readArg('--root') || process.cwd();
|
|
10
|
+
const limit = Number(readArg('--limit') || '10');
|
|
11
|
+
const result = await writeRootStateSummary({
|
|
12
|
+
rootDir,
|
|
13
|
+
limit: Number.isFinite(limit) && limit > 0 ? limit : 10,
|
|
14
|
+
});
|
|
15
|
+
process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
import { resolveContextFromIndex } from '../core/context/index-resolver.js';
|
|
4
|
+
import { getGlobalContextHome } from '../core/settings/global-context-home.js';
|
|
5
|
+
function usage() {
|
|
6
|
+
process.stderr.write('Usage: ax-resolve-context [--index PATH] --query "<text>" [--root DIR] [--max N]\n');
|
|
7
|
+
}
|
|
8
|
+
function readArg(flag) {
|
|
9
|
+
const index = process.argv.indexOf(flag);
|
|
10
|
+
if (index === -1)
|
|
11
|
+
return undefined;
|
|
12
|
+
return process.argv[index + 1];
|
|
13
|
+
}
|
|
14
|
+
const rootDir = readArg('--root') || process.cwd();
|
|
15
|
+
const defaultIndexPath = (() => {
|
|
16
|
+
const home = getGlobalContextHome();
|
|
17
|
+
return readArg('--index') || home.indexPath;
|
|
18
|
+
})();
|
|
19
|
+
const localFallbackIndexPath = `${rootDir}/docs/base-context/index.md`;
|
|
20
|
+
const indexPath = existsSync(defaultIndexPath) ? defaultIndexPath : localFallbackIndexPath;
|
|
21
|
+
const query = readArg('--query');
|
|
22
|
+
const maxMatches = Number.parseInt(readArg('--max') || '5', 10);
|
|
23
|
+
if (!query) {
|
|
24
|
+
usage();
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
27
|
+
const result = await resolveContextFromIndex({
|
|
28
|
+
rootDir,
|
|
29
|
+
indexPath,
|
|
30
|
+
indexRootDir: indexPath === getGlobalContextHome().indexPath ? getGlobalContextHome().root : rootDir,
|
|
31
|
+
query,
|
|
32
|
+
maxMatches: Number.isFinite(maxMatches) && maxMatches > 0 ? maxMatches : 5,
|
|
33
|
+
});
|
|
34
|
+
process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { aggregateReviewVerdicts, writeAggregateReviewArtifacts, } from '../core/review/aggregate-reviews.js';
|
|
3
|
+
import { runReviewLanes } from '../core/review/run-lanes.js';
|
|
4
|
+
function usage() {
|
|
5
|
+
process.stderr.write('Usage: ax-review --topic DIR [--run]\n');
|
|
6
|
+
}
|
|
7
|
+
function readArg(flag) {
|
|
8
|
+
const index = process.argv.indexOf(flag);
|
|
9
|
+
if (index === -1)
|
|
10
|
+
return undefined;
|
|
11
|
+
return process.argv[index + 1];
|
|
12
|
+
}
|
|
13
|
+
const topicDir = readArg('--topic');
|
|
14
|
+
const shouldRun = process.argv.includes('--run');
|
|
15
|
+
if (!topicDir) {
|
|
16
|
+
usage();
|
|
17
|
+
process.exit(1);
|
|
18
|
+
}
|
|
19
|
+
if (shouldRun) {
|
|
20
|
+
await runReviewLanes({ topicDir });
|
|
21
|
+
}
|
|
22
|
+
const result = await aggregateReviewVerdicts({ topicDir });
|
|
23
|
+
await writeAggregateReviewArtifacts(topicDir, result);
|
|
24
|
+
process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
|