GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — claude-code-source-code/src/projectOnboardingState.ts at main · unsignedcpp/claude-code-source-code

Expand file tree

/

projectOnboardingState.ts

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
83 lines (75 loc) · 2.28 KB
/

projectOnboardingState.ts

Copy path

File metadata and controls

83 lines (75 loc) · 2.28 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import memoize from 'lodash-es/memoize.js'
import { join } from 'path'
import {
getCurrentProjectConfig,
saveCurrentProjectConfig,
} from './utils/config.js'
import { getCwd } from './utils/cwd.js'
import { isDirEmpty } from './utils/file.js'
import { getFsImplementation } from './utils/fsOperations.js'
export type Step = {
key: string
text: string
isComplete: boolean
isCompletable: boolean
isEnabled: boolean
}
export function getSteps(): Step[] {
const hasClaudeMd = getFsImplementation().existsSync(
join(getCwd(), 'CLAUDE.md'),
)
const isWorkspaceDirEmpty = isDirEmpty(getCwd())
return [
{
key: 'workspace',
text: 'Ask Claude to create a new app or clone a repository',
isComplete: false,
isCompletable: true,
isEnabled: isWorkspaceDirEmpty,
},
{
key: 'claudemd',
text: 'Run /init to create a CLAUDE.md file with instructions for Claude',
isComplete: hasClaudeMd,
isCompletable: true,
isEnabled: !isWorkspaceDirEmpty,
},
]
}
export function isProjectOnboardingComplete(): boolean {
return getSteps()
.filter(({ isCompletable, isEnabled }) => isCompletable && isEnabled)
.every(({ isComplete }) => isComplete)
}
export function maybeMarkProjectOnboardingComplete(): void {
// Short-circuit on cached config — isProjectOnboardingComplete() hits
// the filesystem, and REPL.tsx calls this on every prompt submit.
if (getCurrentProjectConfig().hasCompletedProjectOnboarding) {
return
}
if (isProjectOnboardingComplete()) {
saveCurrentProjectConfig(current => ({
...current,
hasCompletedProjectOnboarding: true,
}))
}
}
export const shouldShowProjectOnboarding = memoize((): boolean => {
const projectConfig = getCurrentProjectConfig()
// Short-circuit on cached config before isProjectOnboardingComplete()
// hits the filesystem — this runs during first render.
if (
projectConfig.hasCompletedProjectOnboarding ||
projectConfig.projectOnboardingSeenCount >= 4 ||
process.env.IS_DEMO
) {
return false
}
return !isProjectOnboardingComplete()
})
export function incrementProjectOnboardingSeenCount(): void {
saveCurrentProjectConfig(current => ({
...current,
projectOnboardingSeenCount: current.projectOnboardingSeenCount + 1,
}))
}
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.